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 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.httputils2service _httputils2service = null;

public static boolean isAnyActivityVisible() {
    boolean vis = false;
vis = vis | (main.mostCurrent != null);
return vis;}
public static String  _activity_create(boolean _firsttime) throws Exception{
 //BA.debugLineNum = 51;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
 //BA.debugLineNum = 52;BA.debugLine="Activity.Title = \"BusTrack Driver\"";
mostCurrent._activity.setTitle(BA.ObjectToCharSequence("BusTrack Driver"));
 //BA.debugLineNum = 53;BA.debugLine="Activity.Color = Colors.White";
mostCurrent._activity.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 56;BA.debugLine="InitializeLoginUI";
_initializeloginui();
 //BA.debugLineNum = 57;BA.debugLine="InitializeTrackingUI";
_initializetrackingui();
 //BA.debugLineNum = 58;BA.debugLine="InitializeAttendanceUI";
_initializeattendanceui();
 //BA.debugLineNum = 59;BA.debugLine="InitializeScanUI";
_initializescanui();
 //BA.debugLineNum = 61;BA.debugLine="CheckLoginState";
_checkloginstate();
 //BA.debugLineNum = 62;BA.debugLine="End Sub";
return "";
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
 //BA.debugLineNum = 298;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
 //BA.debugLineNum = 300;BA.debugLine="nfc.DisableForegroundDispatch";
mostCurrent._nfc.DisableForegroundDispatch(mostCurrent.activityBA);
 //BA.debugLineNum = 301;BA.debugLine="End Sub";
return "";
}
public static String  _activity_resume() throws Exception{
anywheresoftware.b4a.objects.IntentWrapper _si = null;
 //BA.debugLineNum = 221;BA.debugLine="Sub Activity_Resume";
 //BA.debugLineNum = 223;BA.debugLine="If pnlTracking.IsInitialized And pnlTracking.Visi";
if (mostCurrent._pnltracking.IsInitialized() && mostCurrent._pnltracking.getVisible()) { 
 //BA.debugLineNum = 224;BA.debugLine="UpdateUI";
_updateui();
 };
 //BA.debugLineNum = 228;BA.debugLine="nfc.EnableForegroundDispatch";
mostCurrent._nfc.EnableForegroundDispatch(mostCurrent.activityBA);
 //BA.debugLineNum = 231;BA.debugLine="Dim si As Intent = Activity.GetStartingIntent";
_si = new anywheresoftware.b4a.objects.IntentWrapper();
_si = mostCurrent._activity.GetStartingIntent();
 //BA.debugLineNum = 232;BA.debugLine="If si.IsInitialized And si <> prevIntent Then";
if (_si.IsInitialized() && (_si).equals(_previntent) == false) { 
 //BA.debugLineNum = 233;BA.debugLine="prevIntent = si";
_previntent = _si;
 //BA.debugLineNum = 234;BA.debugLine="If si.Action.EndsWith(\"TECH_DISCOVERED\") Or si.A";
if (_si.getAction().endsWith("TECH_DISCOVERED") || _si.getAction().endsWith("TAG_DISCOVERED") || _si.getAction().endsWith("NDEF_DISCOVERED")) { 
 //BA.debugLineNum = 235;BA.debugLine="ProcessNFCTag(si)";
_processnfctag(_si);
 };
 };
 //BA.debugLineNum = 238;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 = 485;BA.debugLine="Sub btnAction_Click";
 //BA.debugLineNum = 486;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 = 487;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 = 488;BA.debugLine="Dim studentId As Int = data.Get(\"id\")";
_studentid = (int)(BA.ObjectToNumber(_data.Get((Object)("id"))));
 //BA.debugLineNum = 489;BA.debugLine="Dim action As String = data.Get(\"action\")";
_action = BA.ObjectToString(_data.Get((Object)("action")));
 //BA.debugLineNum = 491;BA.debugLine="Dim payload As Map";
_payload = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 492;BA.debugLine="payload.Initialize";
_payload.Initialize();
 //BA.debugLineNum = 493;BA.debugLine="payload.Put(\"student_id\", studentId)";
_payload.Put((Object)("student_id"),(Object)(_studentid));
 //BA.debugLineNum = 494;BA.debugLine="payload.Put(\"action\", action)";
_payload.Put((Object)("action"),(Object)(_action));
 //BA.debugLineNum = 496;BA.debugLine="Dim json As JSONGenerator";
_json = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 497;BA.debugLine="json.Initialize(payload)";
_json.Initialize(_payload);
 //BA.debugLineNum = 499;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 500;BA.debugLine="job.Initialize(\"mark_attendance\", Me)";
_job._initialize /*String*/ (processBA,"mark_attendance",main.getObject());
 //BA.debugLineNum = 501;BA.debugLine="job.PostString(APIModule.ServerURL & \"/mark_atten";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/mark_attendance.php",_json.ToString());
 //BA.debugLineNum = 502;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 504;BA.debugLine="btn.Enabled = False";
_btn.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 505;BA.debugLine="btn.Text = \"...\"";
_btn.setText(BA.ObjectToCharSequence("..."));
 //BA.debugLineNum = 506;BA.debugLine="End Sub";
return "";
}
public static String  _btnattendance_click() throws Exception{
 //BA.debugLineNum = 384;BA.debugLine="Sub btnAttendance_Click";
 //BA.debugLineNum = 385;BA.debugLine="ShowAttendance";
_showattendance();
 //BA.debugLineNum = 386;BA.debugLine="End Sub";
return "";
}
public static String  _btnbacktotracking_click() throws Exception{
 //BA.debugLineNum = 388;BA.debugLine="Sub btnBackToTracking_Click";
 //BA.debugLineNum = 389;BA.debugLine="ShowTracking";
_showtracking();
 //BA.debugLineNum = 390;BA.debugLine="End Sub";
return "";
}
public static String  _btncancelscan_click() throws Exception{
 //BA.debugLineNum = 216;BA.debugLine="Sub btnCancelScan_Click";
 //BA.debugLineNum = 217;BA.debugLine="RegistrationTargetID = 0";
_registrationtargetid = (int) (0);
 //BA.debugLineNum = 218;BA.debugLine="pnlTagScan.Visible = False";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 219;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 = 324;BA.debugLine="Sub btnLogin_Click";
 //BA.debugLineNum = 325;BA.debugLine="Dim phone As String = txtPhone.Text.Trim";
_phone = mostCurrent._txtphone.getText().trim();
 //BA.debugLineNum = 326;BA.debugLine="Dim password As String = txtPass.Text.Trim";
_password = mostCurrent._txtpass.getText().trim();
 //BA.debugLineNum = 328;BA.debugLine="If phone = \"\" Or password = \"\" Then";
if ((_phone).equals("") || (_password).equals("")) { 
 //BA.debugLineNum = 329;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 = 330;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 333;BA.debugLine="btnLogin.Enabled = False";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 334;BA.debugLine="btnLogin.Text = \"Logging in...\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("Logging in..."));
 //BA.debugLineNum = 336;BA.debugLine="Dim data As Map";
_data = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 337;BA.debugLine="data.Initialize";
_data.Initialize();
 //BA.debugLineNum = 338;BA.debugLine="data.Put(\"phone\", phone)";
_data.Put((Object)("phone"),(Object)(_phone));
 //BA.debugLineNum = 339;BA.debugLine="data.Put(\"password\", password)";
_data.Put((Object)("password"),(Object)(_password));
 //BA.debugLineNum = 341;BA.debugLine="Dim json As JSONGenerator";
_json = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 342;BA.debugLine="json.Initialize(data)";
_json.Initialize(_data);
 //BA.debugLineNum = 344;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 345;BA.debugLine="job.Initialize(\"login\", Me)";
_job._initialize /*String*/ (processBA,"login",main.getObject());
 //BA.debugLineNum = 346;BA.debugLine="job.PostString(APIModule.ServerURL & \"/login.php\"";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/login.php",_json.ToString());
 //BA.debugLineNum = 347;BA.debugLine="job.GetRequest.SetHeader(\"Content-Type\", \"applica";
_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ ().SetHeader("Content-Type","application/json");
 //BA.debugLineNum = 348;BA.debugLine="End Sub";
return "";
}
public static String  _btnlogout_click() throws Exception{
 //BA.debugLineNum = 376;BA.debugLine="Sub btnLogout_Click";
 //BA.debugLineNum = 377;BA.debugLine="APIModule.ClearToken";
mostCurrent._apimodule._cleartoken /*String*/ (mostCurrent.activityBA);
 //BA.debugLineNum = 378;BA.debugLine="CallSub(TrackingService, \"StopTracking\")";
anywheresoftware.b4a.keywords.Common.CallSubNew(processBA,(Object)(mostCurrent._trackingservice.getObject()),"StopTracking");
 //BA.debugLineNum = 379;BA.debugLine="txtPhone.Text = \"\"";
mostCurrent._txtphone.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 380;BA.debugLine="txtPass.Text = \"\"";
mostCurrent._txtpass.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 381;BA.debugLine="CheckLoginState";
_checkloginstate();
 //BA.debugLineNum = 382;BA.debugLine="End Sub";
return "";
}
public static String  _btnregtag_click() throws Exception{
anywheresoftware.b4a.objects.ButtonWrapper _btn = null;
 //BA.debugLineNum = 508;BA.debugLine="Sub btnRegTag_Click";
 //BA.debugLineNum = 509;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 = 510;BA.debugLine="RegistrationTargetID = btn.Tag";
_registrationtargetid = (int)(BA.ObjectToNumber(_btn.getTag()));
 //BA.debugLineNum = 513;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 = 514;BA.debugLine="lblScanStatus.TextColor = Colors.LightGray";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 515;BA.debugLine="pnlTagScan.Visible = True";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 516;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 = 351;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 = 352;BA.debugLine="CallSub(TrackingService, \"StopTracking\")";
anywheresoftware.b4a.keywords.Common.CallSubNew(processBA,(Object)(parent.mostCurrent._trackingservice.getObject()),"StopTracking");
 //BA.debugLineNum = 353;BA.debugLine="UpdateUI";
_updateui();
 if (true) break;

case 5:
//C
this.state = 6;
 //BA.debugLineNum = 355;BA.debugLine="rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOC";
parent.mostCurrent._rp.CheckAndRequest(processBA,parent.mostCurrent._rp.PERMISSION_ACCESS_FINE_LOCATION);
 //BA.debugLineNum = 356;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 = 357;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 = 359;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 = 360;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 = 361;BA.debugLine="StartService(TrackingService)";
anywheresoftware.b4a.keywords.Common.StartService(processBA,(Object)(parent.mostCurrent._trackingservice.getObject()));
 //BA.debugLineNum = 362;BA.debugLine="CallSubDelayed(TrackingService, \"StartTracking";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(parent.mostCurrent._trackingservice.getObject()),"StartTracking");
 //BA.debugLineNum = 364;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 = 365;BA.debugLine="UpdateUI";
_updateui();
 if (true) break;

case 13:
//C
this.state = 14;
this.catchState = 0;
 //BA.debugLineNum = 367;BA.debugLine="Log(\"Error starting service: \" & LastException";
anywheresoftware.b4a.keywords.Common.LogImpl("21048593","Error starting service: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 //BA.debugLineNum = 368;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 = 371;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 = 374;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 = 303;BA.debugLine="Sub CheckLoginState";
 //BA.debugLineNum = 304;BA.debugLine="If APIModule.GetToken = \"\" Then";
if ((mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA)).equals("")) { 
 //BA.debugLineNum = 305;BA.debugLine="ShowLogin";
_showlogin();
 }else {
 //BA.debugLineNum = 307;BA.debugLine="ShowTracking";
_showtracking();
 };
 //BA.debugLineNum = 309;BA.debugLine="End Sub";
return "";
}
public static String  _fetchstudents() throws Exception{
com.merosee.bustrack.driver.httpjob _job = null;
 //BA.debugLineNum = 399;BA.debugLine="Sub FetchStudents";
 //BA.debugLineNum = 400;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 401;BA.debugLine="job.Initialize(\"fetch_students\", Me)";
_job._initialize /*String*/ (processBA,"fetch_students",main.getObject());
 //BA.debugLineNum = 402;BA.debugLine="job.Download(APIModule.ServerURL & \"/get_students";
_job._download /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/get_students_by_driver.php");
 //BA.debugLineNum = 403;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 404;BA.debugLine="End Sub";
return "";
}
public static String  _globals() throws Exception{
 //BA.debugLineNum = 21;BA.debugLine="Sub Globals";
 //BA.debugLineNum = 23;BA.debugLine="Private pnlLogin As Panel";
mostCurrent._pnllogin = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 24;BA.debugLine="Private txtPhone As EditText";
mostCurrent._txtphone = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 25;BA.debugLine="Private txtPass As EditText";
mostCurrent._txtpass = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 26;BA.debugLine="Private btnLogin As Button";
mostCurrent._btnlogin = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 29;BA.debugLine="Private pnlTracking As Panel";
mostCurrent._pnltracking = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 30;BA.debugLine="Private lblStatus As Label";
mostCurrent._lblstatus = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 31;BA.debugLine="Private lblDriverInfo As Label";
mostCurrent._lbldriverinfo = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 32;BA.debugLine="Private btnToggle As Button";
mostCurrent._btntoggle = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 33;BA.debugLine="Private btnLogout As Button";
mostCurrent._btnlogout = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 34;BA.debugLine="Private btnAttendance As Button";
mostCurrent._btnattendance = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 37;BA.debugLine="Private pnlAttendance As Panel";
mostCurrent._pnlattendance = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 38;BA.debugLine="Private clvStudents As ScrollView ' Using ScrollV";
mostCurrent._clvstudents = new anywheresoftware.b4a.objects.ScrollViewWrapper();
 //BA.debugLineNum = 39;BA.debugLine="Private btnBackToTracking As Button";
mostCurrent._btnbacktotracking = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 40;BA.debugLine="Private StudentList As List";
mostCurrent._studentlist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 41;BA.debugLine="Private rp As RuntimePermissions";
mostCurrent._rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 42;BA.debugLine="Private nfc As NFC";
mostCurrent._nfc = new anywheresoftware.b4a.objects.NFC();
 //BA.debugLineNum = 43;BA.debugLine="Private RegistrationTargetID As Int = 0 ' 0 means";
_registrationtargetid = (int) (0);
 //BA.debugLineNum = 46;BA.debugLine="Private pnlTagScan As Panel";
mostCurrent._pnltagscan = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 47;BA.debugLine="Private lblScanStatus As Label";
mostCurrent._lblscanstatus = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 48;BA.debugLine="Private btnCancelScan As Button";
mostCurrent._btncancelscan = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 49;BA.debugLine="End Sub";
return "";
}
public static String  _initializeattendanceui() throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _lbltitle = null;
 //BA.debugLineNum = 164;BA.debugLine="Sub InitializeAttendanceUI";
 //BA.debugLineNum = 165;BA.debugLine="pnlAttendance.Initialize(\"\")";
mostCurrent._pnlattendance.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 166;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 = 167;BA.debugLine="pnlAttendance.Color = Colors.White";
mostCurrent._pnlattendance.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 168;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 170;BA.debugLine="Dim lblTitle As Label";
_lbltitle = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 171;BA.debugLine="lblTitle.Initialize(\"\")";
_lbltitle.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 172;BA.debugLine="lblTitle.Text = \"Student Attendance\"";
_lbltitle.setText(BA.ObjectToCharSequence("Student Attendance"));
 //BA.debugLineNum = 173;BA.debugLine="lblTitle.TextSize = 22";
_lbltitle.setTextSize((float) (22));
 //BA.debugLineNum = 174;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 = 175;BA.debugLine="lblTitle.Gravity = Gravity.CENTER";
_lbltitle.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 176;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 = 178;BA.debugLine="btnBackToTracking.Initialize(\"btnBackToTracking\")";
mostCurrent._btnbacktotracking.Initialize(mostCurrent.activityBA,"btnBackToTracking");
 //BA.debugLineNum = 179;BA.debugLine="btnBackToTracking.Text = \"BACK\"";
mostCurrent._btnbacktotracking.setText(BA.ObjectToCharSequence("BACK"));
 //BA.debugLineNum = 180;BA.debugLine="btnBackToTracking.Color = Colors.DarkGray";
mostCurrent._btnbacktotracking.setColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 181;BA.debugLine="btnBackToTracking.TextColor = Colors.White";
mostCurrent._btnbacktotracking.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 182;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 = 184;BA.debugLine="clvStudents.Initialize(0)";
mostCurrent._clvstudents.Initialize(mostCurrent.activityBA,(int) (0));
 //BA.debugLineNum = 185;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 = 186;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 = 64;BA.debugLine="Sub InitializeLoginUI";
 //BA.debugLineNum = 66;BA.debugLine="pnlLogin.Initialize(\"\")";
mostCurrent._pnllogin.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 67;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 = 68;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 = 71;BA.debugLine="Dim lblTitle As Label";
_lbltitle = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 72;BA.debugLine="lblTitle.Initialize(\"\")";
_lbltitle.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 73;BA.debugLine="lblTitle.Text = \"Driver Login\"";
_lbltitle.setText(BA.ObjectToCharSequence("Driver Login"));
 //BA.debugLineNum = 74;BA.debugLine="lblTitle.TextSize = 28";
_lbltitle.setTextSize((float) (28));
 //BA.debugLineNum = 75;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 = 76;BA.debugLine="lblTitle.Gravity = Gravity.CENTER";
_lbltitle.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 77;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 = 80;BA.debugLine="Dim lblPhone As Label";
_lblphone = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 81;BA.debugLine="lblPhone.Initialize(\"\")";
_lblphone.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 82;BA.debugLine="lblPhone.Text = \"Phone Number\"";
_lblphone.setText(BA.ObjectToCharSequence("Phone Number"));
 //BA.debugLineNum = 83;BA.debugLine="lblPhone.TextSize = 14";
_lblphone.setTextSize((float) (14));
 //BA.debugLineNum = 84;BA.debugLine="lblPhone.TextColor = Colors.DarkGray";
_lblphone.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 85;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 = 87;BA.debugLine="txtPhone.Initialize(\"txtPhone\")";
mostCurrent._txtphone.Initialize(mostCurrent.activityBA,"txtPhone");
 //BA.debugLineNum = 88;BA.debugLine="txtPhone.Hint = \"Enter phone number\"";
mostCurrent._txtphone.setHint("Enter phone number");
 //BA.debugLineNum = 89;BA.debugLine="txtPhone.InputType = txtPhone.INPUT_TYPE_PHONE";
mostCurrent._txtphone.setInputType(mostCurrent._txtphone.INPUT_TYPE_PHONE);
 //BA.debugLineNum = 90;BA.debugLine="txtPhone.TextSize = 16";
mostCurrent._txtphone.setTextSize((float) (16));
 //BA.debugLineNum = 91;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 = 94;BA.debugLine="Dim lblPass As Label";
_lblpass = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 95;BA.debugLine="lblPass.Initialize(\"\")";
_lblpass.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 96;BA.debugLine="lblPass.Text = \"Password\"";
_lblpass.setText(BA.ObjectToCharSequence("Password"));
 //BA.debugLineNum = 97;BA.debugLine="lblPass.TextSize = 14";
_lblpass.setTextSize((float) (14));
 //BA.debugLineNum = 98;BA.debugLine="lblPass.TextColor = Colors.DarkGray";
_lblpass.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 99;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 = 101;BA.debugLine="txtPass.Initialize(\"txtPass\")";
mostCurrent._txtpass.Initialize(mostCurrent.activityBA,"txtPass");
 //BA.debugLineNum = 102;BA.debugLine="txtPass.Hint = \"Enter password\"";
mostCurrent._txtpass.setHint("Enter password");
 //BA.debugLineNum = 103;BA.debugLine="txtPass.PasswordMode = True";
mostCurrent._txtpass.setPasswordMode(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 104;BA.debugLine="txtPass.TextSize = 16";
mostCurrent._txtpass.setTextSize((float) (16));
 //BA.debugLineNum = 105;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 = 108;BA.debugLine="btnLogin.Initialize(\"btnLogin\")";
mostCurrent._btnlogin.Initialize(mostCurrent.activityBA,"btnLogin");
 //BA.debugLineNum = 109;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 //BA.debugLineNum = 110;BA.debugLine="btnLogin.TextSize = 18";
mostCurrent._btnlogin.setTextSize((float) (18));
 //BA.debugLineNum = 111;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 = 112;BA.debugLine="btnLogin.TextColor = Colors.White";
mostCurrent._btnlogin.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 113;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 = 114;BA.debugLine="End Sub";
return "";
}
public static String  _initializescanui() throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _lbltitle = null;
 //BA.debugLineNum = 188;BA.debugLine="Sub InitializeScanUI";
 //BA.debugLineNum = 189;BA.debugLine="pnlTagScan.Initialize(\"pnlTagScan\")";
mostCurrent._pnltagscan.Initialize(mostCurrent.activityBA,"pnlTagScan");
 //BA.debugLineNum = 190;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 = 191;BA.debugLine="pnlTagScan.Color = Colors.ARGB(230, 0, 0, 0) ' Se";
mostCurrent._pnltagscan.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int) (230),(int) (0),(int) (0),(int) (0)));
 //BA.debugLineNum = 192;BA.debugLine="pnlTagScan.Visible = False";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 194;BA.debugLine="Dim lblTitle As Label";
_lbltitle = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 195;BA.debugLine="lblTitle.Initialize(\"\")";
_lbltitle.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 196;BA.debugLine="lblTitle.Text = \"REGISTER NEW TAG\"";
_lbltitle.setText(BA.ObjectToCharSequence("REGISTER NEW TAG"));
 //BA.debugLineNum = 197;BA.debugLine="lblTitle.TextSize = 22";
_lbltitle.setTextSize((float) (22));
 //BA.debugLineNum = 198;BA.debugLine="lblTitle.TextColor = Colors.White";
_lbltitle.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 199;BA.debugLine="lblTitle.Gravity = Gravity.CENTER";
_lbltitle.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 200;BA.debugLine="pnlTagScan.AddView(lblTitle, 10%x, 30%y, 80%x, 50";
mostCurrent._pnltagscan.AddView((android.view.View)(_lbltitle.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) (50)));
 //BA.debugLineNum = 202;BA.debugLine="lblScanStatus.Initialize(\"\")";
mostCurrent._lblscanstatus.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 203;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 = 204;BA.debugLine="lblScanStatus.TextSize = 16";
mostCurrent._lblscanstatus.setTextSize((float) (16));
 //BA.debugLineNum = 205;BA.debugLine="lblScanStatus.TextColor = Colors.LightGray";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 206;BA.debugLine="lblScanStatus.Gravity = Gravity.CENTER";
mostCurrent._lblscanstatus.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 207;BA.debugLine="pnlTagScan.AddView(lblScanStatus, 5%x, 40%y, 90%x";
mostCurrent._pnltagscan.AddView((android.view.View)(mostCurrent._lblscanstatus.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (40),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (90),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (100)));
 //BA.debugLineNum = 209;BA.debugLine="btnCancelScan.Initialize(\"btnCancelScan\")";
mostCurrent._btncancelscan.Initialize(mostCurrent.activityBA,"btnCancelScan");
 //BA.debugLineNum = 210;BA.debugLine="btnCancelScan.Text = \"CANCEL\"";
mostCurrent._btncancelscan.setText(BA.ObjectToCharSequence("CANCEL"));
 //BA.debugLineNum = 211;BA.debugLine="btnCancelScan.TextColor = Colors.White";
mostCurrent._btncancelscan.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 212;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 = 213;BA.debugLine="pnlTagScan.AddView(btnCancelScan, 30%x, 65%y, 40%";
mostCurrent._pnltagscan.AddView((android.view.View)(mostCurrent._btncancelscan.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (30),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (65),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (40),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (50)));
 //BA.debugLineNum = 214;BA.debugLine="End Sub";
return "";
}
public static String  _initializetrackingui() throws Exception{
 //BA.debugLineNum = 116;BA.debugLine="Sub InitializeTrackingUI";
 //BA.debugLineNum = 118;BA.debugLine="pnlTracking.Initialize(\"\")";
mostCurrent._pnltracking.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 119;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 = 120;BA.debugLine="pnlTracking.Color = Colors.White";
mostCurrent._pnltracking.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 121;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 124;BA.debugLine="lblDriverInfo.Initialize(\"\")";
mostCurrent._lbldriverinfo.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 125;BA.debugLine="lblDriverInfo.Text = \"Driver Dashboard\"";
mostCurrent._lbldriverinfo.setText(BA.ObjectToCharSequence("Driver Dashboard"));
 //BA.debugLineNum = 126;BA.debugLine="lblDriverInfo.TextSize = 22";
mostCurrent._lbldriverinfo.setTextSize((float) (22));
 //BA.debugLineNum = 127;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 = 128;BA.debugLine="lblDriverInfo.Gravity = Gravity.CENTER";
mostCurrent._lbldriverinfo.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 129;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 = 132;BA.debugLine="lblStatus.Initialize(\"\")";
mostCurrent._lblstatus.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 133;BA.debugLine="lblStatus.Text = \"Status: IDLE\"";
mostCurrent._lblstatus.setText(BA.ObjectToCharSequence("Status: IDLE"));
 //BA.debugLineNum = 134;BA.debugLine="lblStatus.TextSize = 24";
mostCurrent._lblstatus.setTextSize((float) (24));
 //BA.debugLineNum = 135;BA.debugLine="lblStatus.TextColor = Colors.Red";
mostCurrent._lblstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 136;BA.debugLine="lblStatus.Gravity = Gravity.CENTER";
mostCurrent._lblstatus.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 137;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 = 140;BA.debugLine="btnToggle.Initialize(\"btnToggle\")";
mostCurrent._btntoggle.Initialize(mostCurrent.activityBA,"btnToggle");
 //BA.debugLineNum = 141;BA.debugLine="btnToggle.Text = \"START TRACKING\"";
mostCurrent._btntoggle.setText(BA.ObjectToCharSequence("START TRACKING"));
 //BA.debugLineNum = 142;BA.debugLine="btnToggle.TextSize = 20";
mostCurrent._btntoggle.setTextSize((float) (20));
 //BA.debugLineNum = 143;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 = 144;BA.debugLine="btnToggle.TextColor = Colors.White";
mostCurrent._btntoggle.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 145;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 = 148;BA.debugLine="btnLogout.Initialize(\"btnLogout\")";
mostCurrent._btnlogout.Initialize(mostCurrent.activityBA,"btnLogout");
 //BA.debugLineNum = 149;BA.debugLine="btnLogout.Text = \"LOGOUT\"";
mostCurrent._btnlogout.setText(BA.ObjectToCharSequence("LOGOUT"));
 //BA.debugLineNum = 150;BA.debugLine="btnLogout.TextSize = 16";
mostCurrent._btnlogout.setTextSize((float) (16));
 //BA.debugLineNum = 151;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 = 152;BA.debugLine="btnLogout.TextColor = Colors.White";
mostCurrent._btnlogout.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 153;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 = 156;BA.debugLine="btnAttendance.Initialize(\"btnAttendance\")";
mostCurrent._btnattendance.Initialize(mostCurrent.activityBA,"btnAttendance");
 //BA.debugLineNum = 157;BA.debugLine="btnAttendance.Text = \"MARK ATTENDANCE 📋\"";
mostCurrent._btnattendance.setText(BA.ObjectToCharSequence("MARK ATTENDANCE 📋"));
 //BA.debugLineNum = 158;BA.debugLine="btnAttendance.TextSize = 18";
mostCurrent._btnattendance.setTextSize((float) (18));
 //BA.debugLineNum = 159;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 = 160;BA.debugLine="btnAttendance.TextColor = Colors.White";
mostCurrent._btnattendance.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 161;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 = 162;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 = "";
 //BA.debugLineNum = 536;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 538;BA.debugLine="If Job.Success Then";
if (_job._success /*boolean*/ ) { 
 //BA.debugLineNum = 539;BA.debugLine="If Job.JobName = \"mark_attendance_nfc\" Then";
if ((_job._jobname /*String*/ ).equals("mark_attendance_nfc")) { 
 //BA.debugLineNum = 540;BA.debugLine="Try";
try { //BA.debugLineNum = 541;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 542;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 543;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 544;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 545;BA.debugLine="Dim sName As String = root.Get(\"student_name\"";
_sname = BA.ObjectToString(_root.Get((Object)("student_name")));
 //BA.debugLineNum = 546;BA.debugLine="Dim action As String = root.Get(\"action\")";
_action = BA.ObjectToString(_root.Get((Object)("action")));
 //BA.debugLineNum = 547;BA.debugLine="ToastMessageShow(\"TAP SUCCESS: \" & sName & \"";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("TAP SUCCESS: "+_sname+" "+_action),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 550;BA.debugLine="If pnlAttendance.Visible Then FetchStudents";
if (mostCurrent._pnlattendance.getVisible()) { 
_fetchstudents();};
 }else {
 //BA.debugLineNum = 552;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 = 555;BA.debugLine="Log(\"NFC Parse Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769491","NFC Parse Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 }else if((_job._jobname /*String*/ ).equals("register_tag")) { 
 //BA.debugLineNum = 558;BA.debugLine="Try";
try { //BA.debugLineNum = 559;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 560;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 561;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 562;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 563;BA.debugLine="ToastMessageShow(\"SUCCESS: Tag Assigned!\", Tr";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("SUCCESS: Tag Assigned!"),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 564;BA.debugLine="pnlTagScan.Visible = False ' Close modal on s";
mostCurrent._pnltagscan.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 565;BA.debugLine="FetchStudents";
_fetchstudents();
 }else {
 //BA.debugLineNum = 567;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 = 569;BA.debugLine="lblScanStatus.Text = \"ERROR: \" & root.Get(\"er";
mostCurrent._lblscanstatus.setText(BA.ObjectToCharSequence("ERROR: "+BA.ObjectToString(_root.Get((Object)("error")))));
 //BA.debugLineNum = 570;BA.debugLine="lblScanStatus.TextColor = Colors.Red";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 } 
       catch (Exception e33) {
			processBA.setLastException(e33); //BA.debugLineNum = 573;BA.debugLine="Log(\"Reg Parse Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769509","Reg Parse Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 //BA.debugLineNum = 574;BA.debugLine="Log(\"Server raw response: \" & Job.GetString)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769510","Server raw response: "+_job._getstring /*String*/ (),0);
 };
 }else if((_job._jobname /*String*/ ).equals("login")) { 
 //BA.debugLineNum = 578;BA.debugLine="Try";
try { //BA.debugLineNum = 579;BA.debugLine="Log(\"Login response: \" & Job.GetString)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769515","Login response: "+_job._getstring /*String*/ (),0);
 //BA.debugLineNum = 580;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 581;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 582;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 584;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 = 585;BA.debugLine="If root.ContainsKey(\"api_key\") Then";
if (_root.ContainsKey((Object)("api_key"))) { 
 //BA.debugLineNum = 586;BA.debugLine="Dim apiKey As String = root.Get(\"api_key\")";
_apikey = BA.ObjectToString(_root.Get((Object)("api_key")));
 //BA.debugLineNum = 587;BA.debugLine="APIModule.SaveToken(apiKey)";
mostCurrent._apimodule._savetoken /*String*/ (mostCurrent.activityBA,_apikey);
 };
 //BA.debugLineNum = 590;BA.debugLine="If root.ContainsKey(\"driver\") Then";
if (_root.ContainsKey((Object)("driver"))) { 
 //BA.debugLineNum = 591;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 = 592;BA.debugLine="If driver.ContainsKey(\"name\") Then";
if (_driver.ContainsKey((Object)("name"))) { 
 //BA.debugLineNum = 593;BA.debugLine="Dim driverName As String = driver.Get(\"name";
_drivername = BA.ObjectToString(_driver.Get((Object)("name")));
 //BA.debugLineNum = 594;BA.debugLine="lblDriverInfo.Text = \"Welcome, \" & driverNa";
mostCurrent._lbldriverinfo.setText(BA.ObjectToCharSequence("Welcome, "+_drivername));
 };
 };
 //BA.debugLineNum = 598;BA.debugLine="ToastMessageShow(\"Login successful\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Login successful"),anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 599;BA.debugLine="ShowTracking";
_showtracking();
 }else {
 //BA.debugLineNum = 601;BA.debugLine="Dim errorMsg As String = \"Login failed\"";
_errormsg = "Login failed";
 //BA.debugLineNum = 602;BA.debugLine="If root.ContainsKey(\"error\") Then";
if (_root.ContainsKey((Object)("error"))) { 
 //BA.debugLineNum = 603;BA.debugLine="errorMsg = root.Get(\"error\")";
_errormsg = BA.ObjectToString(_root.Get((Object)("error")));
 };
 //BA.debugLineNum = 605;BA.debugLine="ToastMessageShow(\"Error: \" & errorMsg, True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Error: "+_errormsg),anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 606;BA.debugLine="btnLogin.Enabled = True";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 607;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 };
 } 
       catch (Exception e66) {
			processBA.setLastException(e66); //BA.debugLineNum = 610;BA.debugLine="Log(\"Login error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769546","Login error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 //BA.debugLineNum = 611;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 = 612;BA.debugLine="btnLogin.Enabled = True";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 613;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 };
 }else if((_job._jobname /*String*/ ).equals("fetch_students")) { 
 //BA.debugLineNum = 616;BA.debugLine="Try";
try { //BA.debugLineNum = 617;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 618;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 619;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 620;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 621;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 = 624;BA.debugLine="Log(\"Fetch error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769560","Fetch error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 }else if((_job._jobname /*String*/ ).equals("mark_attendance")) { 
 //BA.debugLineNum = 627;BA.debugLine="Try";
try { //BA.debugLineNum = 628;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 629;BA.debugLine="parser.Initialize(Job.GetString)";
_parser.Initialize(_job._getstring /*String*/ ());
 //BA.debugLineNum = 630;BA.debugLine="Dim root As Map = parser.NextObject";
_root = new anywheresoftware.b4a.objects.collections.Map();
_root = _parser.NextObject();
 //BA.debugLineNum = 631;BA.debugLine="If root.Get(\"success\") = True Then";
if ((_root.Get((Object)("success"))).equals((Object)(anywheresoftware.b4a.keywords.Common.True))) { 
 //BA.debugLineNum = 632;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 = 633;BA.debugLine="FetchStudents ' Refresh list";
_fetchstudents();
 }else {
 //BA.debugLineNum = 635;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 = 636;BA.debugLine="FetchStudents ' Reset UI";
_fetchstudents();
 };
 } 
       catch (Exception e95) {
			processBA.setLastException(e95); //BA.debugLineNum = 639;BA.debugLine="Log(\"Mark error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("21769575","Mark error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 };
 }else {
 //BA.debugLineNum = 643;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 = 644;BA.debugLine="btnLogin.Enabled = True";
mostCurrent._btnlogin.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 645;BA.debugLine="btnLogin.Text = \"LOGIN\"";
mostCurrent._btnlogin.setText(BA.ObjectToCharSequence("LOGIN"));
 };
 //BA.debugLineNum = 647;BA.debugLine="Job.Release";
_job._release /*String*/ ();
 //BA.debugLineNum = 648;BA.debugLine="End Sub";
return "";
}
public static String  _nfc_tagdiscovered(byte[] _tagid,anywheresoftware.b4a.objects.IntentWrapper _intent) throws Exception{
 //BA.debugLineNum = 532;BA.debugLine="Sub nfc_TagDiscovered (TagId() As Byte, Intent As";
 //BA.debugLineNum = 534;BA.debugLine="ProcessNFCTag(Intent)";
_processnfctag(_intent);
 //BA.debugLineNum = 535;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();
httputils2service._process_globals();
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 16;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 17;BA.debugLine="Private prevIntent As Intent";
_previntent = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 18;BA.debugLine="Private LastTapTime As Long = 0";
_lasttaptime = (long) (0);
 //BA.debugLineNum = 19;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 = 241;BA.debugLine="Sub ProcessNFCTag(si As Intent)";
 //BA.debugLineNum = 242;BA.debugLine="Try";
try { //BA.debugLineNum = 243;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 = 244;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 = 246;BA.debugLine="If tag.IsInitialized Then";
if (_tag.IsInitialized()) { 
 //BA.debugLineNum = 247;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 248;BA.debugLine="Dim rawId() As Byte = tag.RunMethod(\"getId\", Nu";
_rawid = (byte[])(_tag.RunMethod("getId",(Object[])(anywheresoftware.b4a.keywords.Common.Null)));
 //BA.debugLineNum = 249;BA.debugLine="Dim nfcId As String = bc.HexFromBytes(rawId)";
_nfcid = _bc.HexFromBytes(_rawid);
 //BA.debugLineNum = 251;BA.debugLine="Log(\"NFC ID Detected: \" & nfcId)";
anywheresoftware.b4a.keywords.Common.LogImpl("2589834","NFC ID Detected: "+_nfcid,0);
 //BA.debugLineNum = 254;BA.debugLine="If pnlTagScan.Visible Then";
if (mostCurrent._pnltagscan.getVisible()) { 
 //BA.debugLineNum = 255;BA.debugLine="lblScanStatus.Text = \"DETECTED: \" & nfcId & CR";
mostCurrent._lblscanstatus.setText(BA.ObjectToCharSequence("DETECTED: "+_nfcid+anywheresoftware.b4a.keywords.Common.CRLF+"Saving to database..."));
 //BA.debugLineNum = 256;BA.debugLine="lblScanStatus.TextColor = Colors.Green";
mostCurrent._lblscanstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Green);
 }else {
 //BA.debugLineNum = 258;BA.debugLine="ToastMessageShow(\"NFC Tag: \" & nfcId, False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("NFC Tag: "+_nfcid),anywheresoftware.b4a.keywords.Common.False);
 };
 //BA.debugLineNum = 262;BA.debugLine="Dim p As PhoneVibrate";
_p = new anywheresoftware.b4a.phone.Phone.PhoneVibrate();
 //BA.debugLineNum = 263;BA.debugLine="p.Vibrate(150)";
_p.Vibrate(processBA,(long) (150));
 //BA.debugLineNum = 266;BA.debugLine="SendTagToServer(nfcId)";
_sendtagtoserver(_nfcid);
 };
 } 
       catch (Exception e20) {
			processBA.setLastException(e20); //BA.debugLineNum = 269;BA.debugLine="Log(\"NFC Extract Error: \" & LastException)";
anywheresoftware.b4a.keywords.Common.LogImpl("2589852","NFC Extract Error: "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA)),0);
 };
 //BA.debugLineNum = 271;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 = 273;BA.debugLine="Sub SendTagToServer(nfcId As String)";
 //BA.debugLineNum = 274;BA.debugLine="Log(\"NFC: Sending to server...\")";
anywheresoftware.b4a.keywords.Common.LogImpl("2655361","NFC: Sending to server...",0);
 //BA.debugLineNum = 275;BA.debugLine="Dim payload As Map";
_payload = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 276;BA.debugLine="payload.Initialize";
_payload.Initialize();
 //BA.debugLineNum = 277;BA.debugLine="payload.Put(\"nfc_id\", nfcId)";
_payload.Put((Object)("nfc_id"),(Object)(_nfcid));
 //BA.debugLineNum = 279;BA.debugLine="If RegistrationTargetID > 0 Then";
if (_registrationtargetid>0) { 
 //BA.debugLineNum = 280;BA.debugLine="payload.Put(\"student_id\", RegistrationTargetID)";
_payload.Put((Object)("student_id"),(Object)(_registrationtargetid));
 //BA.debugLineNum = 281;BA.debugLine="Dim gen As JSONGenerator";
_gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 282;BA.debugLine="gen.Initialize(payload)";
_gen.Initialize(_payload);
 //BA.debugLineNum = 283;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 284;BA.debugLine="job.Initialize(\"register_tag\", Me)";
_job._initialize /*String*/ (processBA,"register_tag",main.getObject());
 //BA.debugLineNum = 285;BA.debugLine="job.PostString(APIModule.ServerURL & \"/register_";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/register_nfc_tag.php",_gen.ToString());
 //BA.debugLineNum = 286;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 //BA.debugLineNum = 287;BA.debugLine="RegistrationTargetID = 0";
_registrationtargetid = (int) (0);
 }else {
 //BA.debugLineNum = 289;BA.debugLine="Dim gen As JSONGenerator";
_gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
 //BA.debugLineNum = 290;BA.debugLine="gen.Initialize(payload)";
_gen.Initialize(_payload);
 //BA.debugLineNum = 291;BA.debugLine="Dim job As HttpJob";
_job = new com.merosee.bustrack.driver.httpjob();
 //BA.debugLineNum = 292;BA.debugLine="job.Initialize(\"mark_attendance_nfc\", Me)";
_job._initialize /*String*/ (processBA,"mark_attendance_nfc",main.getObject());
 //BA.debugLineNum = 293;BA.debugLine="job.PostString(APIModule.ServerURL & \"/mark_atte";
_job._poststring /*String*/ (mostCurrent._apimodule._serverurl /*String*/ +"/mark_attendance_nfc.php",_gen.ToString());
 //BA.debugLineNum = 294;BA.debugLine="APIModule.SetAuthHeader(job, APIModule.GetToken)";
mostCurrent._apimodule._setauthheader /*String*/ (mostCurrent.activityBA,_job,mostCurrent._apimodule._gettoken /*String*/ (mostCurrent.activityBA));
 };
 //BA.debugLineNum = 296;BA.debugLine="End Sub";
return "";
}
public static String  _showattendance() throws Exception{
 //BA.debugLineNum = 392;BA.debugLine="Sub ShowAttendance";
 //BA.debugLineNum = 393;BA.debugLine="pnlLogin.Visible = False";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 394;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 395;BA.debugLine="pnlAttendance.Visible = True";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 396;BA.debugLine="FetchStudents";
_fetchstudents();
 //BA.debugLineNum = 397;BA.debugLine="End Sub";
return "";
}
public static String  _showlogin() throws Exception{
 //BA.debugLineNum = 311;BA.debugLine="Sub ShowLogin";
 //BA.debugLineNum = 312;BA.debugLine="pnlLogin.Visible = True";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 313;BA.debugLine="pnlTracking.Visible = False";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 314;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 315;BA.debugLine="End Sub";
return "";
}
public static String  _showtracking() throws Exception{
 //BA.debugLineNum = 317;BA.debugLine="Sub ShowTracking";
 //BA.debugLineNum = 318;BA.debugLine="pnlLogin.Visible = False";
mostCurrent._pnllogin.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 319;BA.debugLine="pnlTracking.Visible = True";
mostCurrent._pnltracking.setVisible(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 320;BA.debugLine="pnlAttendance.Visible = False";
mostCurrent._pnlattendance.setVisible(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 321;BA.debugLine="UpdateUI";
_updateui();
 //BA.debugLineNum = 322;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 = 406;BA.debugLine="Sub UpdateStudentList(students As List)";
 //BA.debugLineNum = 407;BA.debugLine="StudentList = students";
mostCurrent._studentlist = _students;
 //BA.debugLineNum = 408;BA.debugLine="clvStudents.Panel.RemoveAllViews";
mostCurrent._clvstudents.getPanel().RemoveAllViews();
 //BA.debugLineNum = 410;BA.debugLine="Dim itemHeight As Int = 110dip";
_itemheight = anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (110));
 //BA.debugLineNum = 411;BA.debugLine="clvStudents.Panel.Height = students.Size * itemHe";
mostCurrent._clvstudents.getPanel().setHeight((int) (_students.getSize()*_itemheight));
 //BA.debugLineNum = 413;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 = 414;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 = 415;BA.debugLine="Dim p As Panel";
_p = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 416;BA.debugLine="p.Initialize(\"\")";
_p.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 417;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 = 419;BA.debugLine="Dim lblName As Label";
_lblname = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 420;BA.debugLine="lblName.Initialize(\"\")";
_lblname.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 421;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 = 422;BA.debugLine="lblName.TextSize = 16";
_lblname.setTextSize((float) (16));
 //BA.debugLineNum = 423;BA.debugLine="lblName.Typeface = Typeface.DEFAULT_BOLD";
_lblname.setTypeface(anywheresoftware.b4a.keywords.Common.Typeface.DEFAULT_BOLD);
 //BA.debugLineNum = 424;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 = 426;BA.debugLine="Dim lblStop As Label";
_lblstop = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 427;BA.debugLine="lblStop.Initialize(\"\")";
_lblstop.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 428;BA.debugLine="lblStop.Text = \"📍 \" & s.Get(\"stop_name\")";
_lblstop.setText(BA.ObjectToCharSequence("📍 "+BA.ObjectToString(_s.Get((Object)("stop_name")))));
 //BA.debugLineNum = 429;BA.debugLine="lblStop.TextSize = 14";
_lblstop.setTextSize((float) (14));
 //BA.debugLineNum = 430;BA.debugLine="lblStop.TextColor = Colors.DarkGray";
_lblstop.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 431;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 = 433;BA.debugLine="Dim status As String = s.GetDefault(\"current_sta";
_status = BA.ObjectToString(_s.GetDefault((Object)("current_status"),(Object)("")));
 //BA.debugLineNum = 435;BA.debugLine="Dim btnPickup As Button";
_btnpickup = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 436;BA.debugLine="btnPickup.Initialize(\"btnAction\")";
_btnpickup.Initialize(mostCurrent.activityBA,"btnAction");
 //BA.debugLineNum = 437;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 = 438;BA.debugLine="btnPickup.Text = \"PICKUP\"";
_btnpickup.setText(BA.ObjectToCharSequence("PICKUP"));
 //BA.debugLineNum = 439;BA.debugLine="btnPickup.TextSize = 12";
_btnpickup.setTextSize((float) (12));
 //BA.debugLineNum = 440;BA.debugLine="If status = \"pickup\" Then";
if ((_status).equals("pickup")) { 
 //BA.debugLineNum = 441;BA.debugLine="btnPickup.Color = Colors.Green";
_btnpickup.setColor(anywheresoftware.b4a.keywords.Common.Colors.Green);
 //BA.debugLineNum = 442;BA.debugLine="btnPickup.Enabled = False";
_btnpickup.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 }else {
 //BA.debugLineNum = 444;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 = 446;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 = 448;BA.debugLine="Dim btnDrop As Button";
_btndrop = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 449;BA.debugLine="btnDrop.Initialize(\"btnAction\")";
_btndrop.Initialize(mostCurrent.activityBA,"btnAction");
 //BA.debugLineNum = 450;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 = 451;BA.debugLine="btnDrop.Text = \"DROP\"";
_btndrop.setText(BA.ObjectToCharSequence("DROP"));
 //BA.debugLineNum = 452;BA.debugLine="btnDrop.TextSize = 12";
_btndrop.setTextSize((float) (12));
 //BA.debugLineNum = 453;BA.debugLine="If status = \"drop\" Then";
if ((_status).equals("drop")) { 
 //BA.debugLineNum = 454;BA.debugLine="btnDrop.Color = Colors.Red";
_btndrop.setColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 455;BA.debugLine="btnDrop.Enabled = False";
_btndrop.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 }else {
 //BA.debugLineNum = 457;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 = 459;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 = 462;BA.debugLine="Dim hasNfc As Boolean = False";
_hasnfc = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 463;BA.debugLine="If s.ContainsKey(\"nfc_id\") Then";
if (_s.ContainsKey((Object)("nfc_id"))) { 
 //BA.debugLineNum = 464;BA.debugLine="Dim nId As String = s.Get(\"nfc_id\")";
_nid = BA.ObjectToString(_s.Get((Object)("nfc_id")));
 //BA.debugLineNum = 465;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 = 468;BA.debugLine="If hasNfc = False Then";
if (_hasnfc==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 469;BA.debugLine="Dim btnReg As Button";
_btnreg = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 470;BA.debugLine="btnReg.Initialize(\"btnRegTag\")";
_btnreg.Initialize(mostCurrent.activityBA,"btnRegTag");
 //BA.debugLineNum = 471;BA.debugLine="btnReg.Tag = s.Get(\"id\")";
_btnreg.setTag(_s.Get((Object)("id")));
 //BA.debugLineNum = 472;BA.debugLine="btnReg.Text = \"🆔\"";
_btnreg.setText(BA.ObjectToCharSequence("🆔"));
 //BA.debugLineNum = 473;BA.debugLine="btnReg.TextSize = 14";
_btnreg.setTextSize((float) (14));
 //BA.debugLineNum = 474;BA.debugLine="btnReg.Color = Colors.DarkGray";
_btnreg.setColor(anywheresoftware.b4a.keywords.Common.Colors.DarkGray);
 //BA.debugLineNum = 475;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 = 478;BA.debugLine="Dim line As Panel";
_line = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 479;BA.debugLine="line.Initialize(\"\")";
_line.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 480;BA.debugLine="line.Color = Colors.LightGray";
_line.setColor(anywheresoftware.b4a.keywords.Common.Colors.LightGray);
 //BA.debugLineNum = 481;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 = 483;BA.debugLine="End Sub";
return "";
}
public static String  _updateui() throws Exception{
 //BA.debugLineNum = 518;BA.debugLine="Sub UpdateUI";
 //BA.debugLineNum = 519;BA.debugLine="If TrackingService.IsTracking Then";
if (mostCurrent._trackingservice._istracking /*boolean*/ ) { 
 //BA.debugLineNum = 520;BA.debugLine="btnToggle.Text = \"STOP TRACKING\"";
mostCurrent._btntoggle.setText(BA.ObjectToCharSequence("STOP TRACKING"));
 //BA.debugLineNum = 521;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 = 522;BA.debugLine="lblStatus.Text = \"Status: TRACKING\"";
mostCurrent._lblstatus.setText(BA.ObjectToCharSequence("Status: TRACKING"));
 //BA.debugLineNum = 523;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 = 525;BA.debugLine="btnToggle.Text = \"START TRACKING\"";
mostCurrent._btntoggle.setText(BA.ObjectToCharSequence("START TRACKING"));
 //BA.debugLineNum = 526;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 = 527;BA.debugLine="lblStatus.Text = \"Status: IDLE\"";
mostCurrent._lblstatus.setText(BA.ObjectToCharSequence("Status: IDLE"));
 //BA.debugLineNum = 528;BA.debugLine="lblStatus.TextColor = Colors.Red";
mostCurrent._lblstatus.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 530;BA.debugLine="End Sub";
return "";
}
}
