@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (isFirst) { processBA = new BA(this.getApplicationContext(), null, null, "b4a.example", "b4a.example.main"); processBA.loadHtSubs(this.getClass()); float deviceScale = getApplicationContext().getResources().getDisplayMetrics().density; BALayout.setDeviceScale(deviceScale); } else if (previousOne != null) { Activity p = previousOne.get(); if (p != null && p != this) { BA.LogInfo("Killing previous instance (main)."); p.finish(); } } processBA.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); } mostCurrent = this; processBA.sharedProcessBA.activityBA = null; layout = new BALayout(this); setContentView(layout); afterFirstLayout = false; BA.handler.postDelayed(new WaitForLayout(), 5); }
@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 onKeyUp(int keyCode, android.view.KeyEvent event) { 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 onPause() { super.onPause(); if (_activity == null) // workaround for emulator bug (Issue 2423) return; anywheresoftware.b4a.Msgbox.dismiss(true); BA.LogInfo( "** Activity (register) Pause, UserClosed = " + activityBA.activity.isFinishing() + " **"); processBA.raiseEvent2( _activity, true, "activity_pause", false, activityBA.activity.isFinishing()); processBA.setActivityPaused(true); mostCurrent = null; if (!activityBA.activity.isFinishing()) previousOne = new WeakReference<Activity>(this); anywheresoftware.b4a.Msgbox.isDismissing = false; }
@Override public boolean onOptionsItemSelected(android.view.MenuItem item) { if (item.getItemId() == 16908332) { processBA.raiseEvent(null, "activity_actionbarhomeclick"); return true; } else return super.onOptionsItemSelected(item); }
public static String _ioioconnect() throws Exception { // BA.debugLineNum = 49;BA.debugLine="Sub IOIOConnect"; // BA.debugLineNum = 50;BA.debugLine="Try"; try { // BA.debugLineNum = 51;BA.debugLine="YOYO.Initialize"; _yoyo.Initialize(); // BA.debugLineNum = 52;BA.debugLine="YOYO.WaitForConnect"; _yoyo.WaitForConnect(); // BA.debugLineNum = 53;BA.debugLine="pin33_SensorFuerza= YOYO.OpenAnalogInput(33)"; _pin33_sensorfuerza.setObject((ioio.lib.api.AnalogInput) (_yoyo.OpenAnalogInput((int) (33)))); // BA.debugLineNum = 54;BA.debugLine="pin11_Zumbador= YOYO.OpenPwmOutput(11,pin11_Zumb"; _pin11_zumbador.setObject( (ioio.lib.api.PwmOutput) (_yoyo.OpenPwmOutput((int) (11), _pin11_zumbador.OP_NORMAL, (int) (2000)))); } catch (Exception e26) { processBA.setLastException( e26); // BA.debugLineNum = 56;BA.debugLine="Log(\"YOYO Exception: \"& // LastException.Message)"; anywheresoftware.b4a.keywords.Common.Log( "YOYO Exception: " + anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA) .getMessage()); } ; // BA.debugLineNum = 58;BA.debugLine="End Sub"; return ""; }
@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); }
@Override public boolean onKeyDown(int keyCode, android.view.KeyEvent event) { 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 void afterFirstLayout() { if (this != mostCurrent) return; activityBA = new BA( this, layout, processBA, "metube.mncplaymedia.com", "metube.mncplaymedia.com.register"); 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, "metube.mncplaymedia.com.register", processBA, activityBA, _activity, anywheresoftware.b4a.keywords.Common.Density, mostCurrent); _activity.reinitializeForShell(activityBA, "activity"); } initializeProcessGlobals(); initializeGlobals(); BA.LogInfo("** Activity (register) Create, isFirst = " + isFirst + " **"); processBA.raiseEvent2(null, true, "activity_create", false, isFirst); isFirst = false; if (this != mostCurrent) return; processBA.setActivityPaused(false); BA.LogInfo("** Activity (register) 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 static String _ioioclose() throws Exception { // BA.debugLineNum = 60;BA.debugLine="Sub IOIOClose"; // BA.debugLineNum = 61;BA.debugLine="Try"; try { // BA.debugLineNum = 62;BA.debugLine="pin33_SensorFuerza.Close"; _pin33_sensorfuerza.Close(); // BA.debugLineNum = 63;BA.debugLine="YOYO.Disconnect"; _yoyo.Disconnect(); // BA.debugLineNum = 64;BA.debugLine="YOYO.WaitForDisconnect"; _yoyo.WaitForDisconnect(); } catch (Exception e35) { processBA.setLastException( e35); // BA.debugLineNum = 66;BA.debugLine="Log(\"YOYO Close Exception: \"& // LastException.Mess"; anywheresoftware.b4a.keywords.Common.Log( "YOYO Close Exception: " + anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA) .getMessage()); } ; // BA.debugLineNum = 68;BA.debugLine="End Sub"; return ""; }
@Override public void onDestroy() { super.onDestroy(); previousOne = null; processBA.runHook("ondestroy", this, null); }
public static String _jobdone(metube.mncplaymedia.com.mnchttpjob _mnchttp) throws Exception { try { Debug.PushSubsStack( "JobDone (register) ", "register", 3, mostCurrent.activityBA, mostCurrent, 99); adr.stringfunctions.stringfunctions _sf = null; String _stmp = ""; anywheresoftware.b4a.objects.collections.JSONParser _parser = null; anywheresoftware.b4a.objects.collections.Map _mresult = null; byte[] _btmp = null; anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bctmp = null; anywheresoftware.b4a.objects.StringUtils _su = null; Debug.locals.put("MNChttp", _mnchttp); BA.debugLineNum = 99; BA.debugLine = "Sub JobDone (MNChttp As MNChttpjob)"; Debug.ShouldStop(4); BA.debugLineNum = 100; BA.debugLine = "Dim sf As StringFunctions"; Debug.ShouldStop(8); _sf = new adr.stringfunctions.stringfunctions(); Debug.locals.put("sf", _sf); BA.debugLineNum = 101; BA.debugLine = "Dim sTmp As String"; Debug.ShouldStop(16); _stmp = ""; Debug.locals.put("sTmp", _stmp); BA.debugLineNum = 102; BA.debugLine = "Dim parser As JSONParser"; Debug.ShouldStop(32); _parser = new anywheresoftware.b4a.objects.collections.JSONParser(); Debug.locals.put("parser", _parser); BA.debugLineNum = 103; BA.debugLine = "Dim mresult As Map"; Debug.ShouldStop(64); _mresult = new anywheresoftware.b4a.objects.collections.Map(); Debug.locals.put("mresult", _mresult); BA.debugLineNum = 104; BA.debugLine = "Dim bTmp() As Byte"; Debug.ShouldStop(128); _btmp = new byte[(int) (0)]; ; Debug.locals.put("bTmp", _btmp); BA.debugLineNum = 105; BA.debugLine = "Dim bcTmp As ByteConverter"; Debug.ShouldStop(256); _bctmp = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter(); Debug.locals.put("bcTmp", _bctmp); BA.debugLineNum = 106; BA.debugLine = "Dim su As StringUtils"; Debug.ShouldStop(512); _su = new anywheresoftware.b4a.objects.StringUtils(); Debug.locals.put("su", _su); BA.debugLineNum = 108; BA.debugLine = "Log((MNChttp.GetString))"; Debug.ShouldStop(2048); anywheresoftware.b4a.keywords.Common.Log((_mnchttp._getstring())); BA.debugLineNum = 110; BA.debugLine = "If MNChttp.Success = False Then"; Debug.ShouldStop(8192); if (_mnchttp._success == anywheresoftware.b4a.keywords.Common.False) { BA.debugLineNum = 111; BA.debugLine = "If (sf.InString(MNChttp.ErrorMessage, \"timed out\") > 0) OR (sf.InString(MNChttp.ErrorMessage, \"refused\") > 0) OR _ (sf.InString(MNChttp.ErrorMessage, \"Unable to resolve host\") > 0) OR (sf.InString(MNChttp.ErrorMessage, \"UnknownHostException\") > 0) OR _ (sf.InString(MNChttp.ErrorMessage, \"FileNotFound\") > 0) Then"; Debug.ShouldStop(16384); if ((_sf._vvv4(_mnchttp._errormessage, "timed out") > 0) || (_sf._vvv4(_mnchttp._errormessage, "refused") > 0) || (_sf._vvv4(_mnchttp._errormessage, "Unable to resolve host") > 0) || (_sf._vvv4(_mnchttp._errormessage, "UnknownHostException") > 0) || (_sf._vvv4(_mnchttp._errormessage, "FileNotFound") > 0)) { BA.debugLineNum = 115; BA.debugLine = "Msgbox2(\"Offline Connection or Server Down\", \"Moviebay\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))"; Debug.ShouldStop(262144); anywheresoftware.b4a.keywords.Common.Msgbox2( "Offline Connection or Server Down", "Moviebay", "OK", "", "", (android.graphics.Bitmap) (anywheresoftware.b4a.keywords.Common.LoadBitmap( anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png") .getObject()), mostCurrent.activityBA); } else { BA.debugLineNum = 117; BA.debugLine = "If sf.InString(MNChttp.ErrorMessage, \"Not Found\") < 0 Then"; Debug.ShouldStop(1048576); if (_sf._vvv4(_mnchttp._errormessage, "Not Found") < 0) { BA.debugLineNum = 119; BA.debugLine = "Msgbox2(\"Unknown Error\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))"; Debug.ShouldStop(4194304); anywheresoftware.b4a.keywords.Common.Msgbox2( "Unknown Error", "MeTube", "OK", "", "", (android.graphics.Bitmap) (anywheresoftware.b4a.keywords.Common.LoadBitmap( anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png") .getObject()), mostCurrent.activityBA); } ; } ; BA.debugLineNum = 123; BA.debugLine = "Fungsi.mpList.Put(\"Koneksi\", \"Offline\")"; Debug.ShouldStop(67108864); mostCurrent._fungsi._mplist.Put((Object) ("Koneksi"), (Object) ("Offline")); BA.debugLineNum = 124; BA.debugLine = "MNChttp.Release"; Debug.ShouldStop(134217728); _mnchttp._release(); } else { BA.debugLineNum = 129; BA.debugLine = "Try"; Debug.ShouldStop(1); try { BA.debugLineNum = 132; BA.debugLine = "parser.Initialize(MNChttp.GetString)"; Debug.ShouldStop(8); _parser.Initialize(_mnchttp._getstring()); BA.debugLineNum = 133; BA.debugLine = "MNChttp.Release"; Debug.ShouldStop(16); _mnchttp._release(); } catch (Exception e97) { processBA.setLastException(e97); BA.debugLineNum = 135; BA.debugLine = "Msgbox2(\"Process Failure !\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))"; Debug.ShouldStop(64); anywheresoftware.b4a.keywords.Common.Msgbox2( "Process Failure !", "MeTube", "OK", "", "", (android.graphics.Bitmap) (anywheresoftware.b4a.keywords.Common.LoadBitmap( anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png") .getObject()), mostCurrent.activityBA); BA.debugLineNum = 136; BA.debugLine = "Return"; Debug.ShouldStop(128); if (true) return ""; } ; BA.debugLineNum = 139; BA.debugLine = "Try"; Debug.ShouldStop(1024); try { BA.debugLineNum = 140; BA.debugLine = "mresult.Initialize"; Debug.ShouldStop(2048); _mresult.Initialize(); BA.debugLineNum = 141; BA.debugLine = "mresult = parser.NextObject"; Debug.ShouldStop(4096); _mresult = _parser.NextObject(); Debug.locals.put("mresult", _mresult); } catch (Exception e104) { processBA.setLastException(e104); BA.debugLineNum = 143; BA.debugLine = "Msgbox2(\"Process Failure !\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))"; Debug.ShouldStop(16384); anywheresoftware.b4a.keywords.Common.Msgbox2( "Process Failure !", "MeTube", "OK", "", "", (android.graphics.Bitmap) (anywheresoftware.b4a.keywords.Common.LoadBitmap( anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png") .getObject()), mostCurrent.activityBA); BA.debugLineNum = 144; BA.debugLine = "Return"; Debug.ShouldStop(32768); if (true) return ""; } ; BA.debugLineNum = 147; BA.debugLine = "If mresult.Get(\"error_code\") <> \"0\" Then"; Debug.ShouldStop(262144); if ((_mresult.Get((Object) ("error_code"))).equals((Object) ("0")) == false) { BA.debugLineNum = 148; BA.debugLine = "Msgbox2(mresult.Get(\"error_msg\"), \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))"; Debug.ShouldStop(524288); anywheresoftware.b4a.keywords.Common.Msgbox2( BA.ObjectToString(_mresult.Get((Object) ("error_msg"))), "MeTube", "OK", "", "", (android.graphics.Bitmap) (anywheresoftware.b4a.keywords.Common.LoadBitmap( anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png") .getObject()), mostCurrent.activityBA); } else { BA.debugLineNum = 150; BA.debugLine = "Fungsi.mpList.Put(\"Koneksi\", \"Online\")"; Debug.ShouldStop(2097152); mostCurrent._fungsi._mplist.Put((Object) ("Koneksi"), (Object) ("Online")); BA.debugLineNum = 151; BA.debugLine = "MNChttp.Release"; Debug.ShouldStop(4194304); _mnchttp._release(); BA.debugLineNum = 153; BA.debugLine = "Select MNChttp.JobName"; Debug.ShouldStop(16777216); switch (BA.switchObjectToInt(_mnchttp._jobname)) { } ; } ; } ; BA.debugLineNum = 158; BA.debugLine = "End Sub"; Debug.ShouldStop(536870912); return ""; } catch (Exception e) { Debug.ErrorCaught(e); throw e; } finally { Debug.PopSubsStack(); } }
public static String _bsimpan_click() throws Exception { try { Debug.PushSubsStack( "bSimpan_Click (register) ", "register", 3, mostCurrent.activityBA, mostCurrent, 81); metube.mncplaymedia.com.mnchttpjob _homejob = null; String _strenc = ""; anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _gen = null; anywheresoftware.b4a.objects.collections.Map _mlogin = null; anywheresoftware.b4a.objects.collections.List _mlist = null; anywheresoftware.b4a.objects.collections.Map _mmap = null; BA.debugLineNum = 81; BA.debugLine = "Sub bSimpan_Click"; Debug.ShouldStop(65536); BA.debugLineNum = 82; BA.debugLine = "Dim HomeJob As MNChttpjob"; Debug.ShouldStop(131072); _homejob = new metube.mncplaymedia.com.mnchttpjob(); Debug.locals.put("HomeJob", _homejob); BA.debugLineNum = 83; BA.debugLine = "Dim strEnc As String"; Debug.ShouldStop(262144); _strenc = ""; Debug.locals.put("strEnc", _strenc); BA.debugLineNum = 84; BA.debugLine = "Dim Gen As JSONGenerator"; Debug.ShouldStop(524288); _gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator(); Debug.locals.put("Gen", _gen); BA.debugLineNum = 85; BA.debugLine = "Dim mlogin As Map"; Debug.ShouldStop(1048576); _mlogin = new anywheresoftware.b4a.objects.collections.Map(); Debug.locals.put("mlogin", _mlogin); BA.debugLineNum = 86; BA.debugLine = "Dim mlist As List"; Debug.ShouldStop(2097152); _mlist = new anywheresoftware.b4a.objects.collections.List(); Debug.locals.put("mlist", _mlist); BA.debugLineNum = 87; BA.debugLine = "Dim mMap As Map"; Debug.ShouldStop(4194304); _mmap = new anywheresoftware.b4a.objects.collections.Map(); Debug.locals.put("mMap", _mmap); BA.debugLineNum = 89; BA.debugLine = "HomeJob.Initialize(\"Register\", Me)"; Debug.ShouldStop(16777216); _homejob._initialize(processBA, "Register", register.getObject()); BA.debugLineNum = 91; BA.debugLine = "Try"; Debug.ShouldStop(67108864); try { BA.debugLineNum = 92; BA.debugLine = "HomeJob.Tag = \"Register\""; Debug.ShouldStop(134217728); _homejob._tag = (Object) ("Register"); Debug.locals.put("HomeJob", _homejob); BA.debugLineNum = 93; BA.debugLine = "HomeJob.PostString(Fungsi.mpList.Get(\"RegisterURL\"), Fungsi.mpList.Get(\"firstname\") & etFirst.text & \"&\" & Fungsi.mpList.Get(\"lastname\") & etLast.Text & \"&\" & Fungsi.mpList.Get(\"regemail\") & etMail.Text & \"&\" & Fungsi.mpList.Get(\"regpass\") & etPass.Text )"; Debug.ShouldStop(268435456); _homejob._poststring( BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("RegisterURL"))), BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("firstname"))) + mostCurrent._etfirst.getText() + "&" + BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("lastname"))) + mostCurrent._etlast.getText() + "&" + BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("regemail"))) + mostCurrent._etmail.getText() + "&" + BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("regpass"))) + mostCurrent._etpass.getText()); BA.debugLineNum = 94; BA.debugLine = "HomeJob.GetRequest.Timeout = DateTime.TicksPerSecond * 60"; Debug.ShouldStop(536870912); _homejob ._getrequest() .setTimeout((int) (anywheresoftware.b4a.keywords.Common.DateTime.TicksPerSecond * 60)); } catch (Exception e70) { processBA.setLastException(e70); BA.debugLineNum = 96; BA.debugLine = "Msgbox2(\"Register Failure !\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))"; Debug.ShouldStop(-2147483648); anywheresoftware.b4a.keywords.Common.Msgbox2( "Register Failure !", "MeTube", "OK", "", "", (android.graphics.Bitmap) (anywheresoftware.b4a.keywords.Common.LoadBitmap( anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png") .getObject()), mostCurrent.activityBA); } ; BA.debugLineNum = 98; BA.debugLine = "End Sub"; Debug.ShouldStop(2); return ""; } catch (Exception e) { Debug.ErrorCaught(e); throw e; } finally { Debug.PopSubsStack(); } }
private static void initializeGlobals() { processBA.raiseEvent2(null, true, "globals", false, (Object[]) null); }
@Override protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data) { processBA.onActivityResult(requestCode, resultCode, data); }
public void run() { if (mostCurrent == null || mostCurrent != activity.get()) return; processBA.setActivityPaused(false); BA.LogInfo("** Activity (register) Resume **"); processBA.raiseEvent(mostCurrent._activity, "activity_resume", (Object[]) null); }
protected void onStart() { super.onStart(); processBA.runHook("onstart", this, null); }
protected void onStop() { super.onStop(); processBA.runHook("onstop", this, null); }
@Override public void onNewIntent(android.content.Intent intent) { super.onNewIntent(intent); this.setIntent(intent); processBA.runHook("onnewintent", this, new Object[] {intent}); }
public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (processBA.subExists("activity_windowfocuschanged")) processBA.raiseEvent2(null, true, "activity_windowfocuschanged", false, hasFocus); }
@Override public boolean onPrepareOptionsMenu(android.view.Menu menu) { super.onPrepareOptionsMenu(menu); processBA.runHook("onprepareoptionsmenu", this, new Object[] {menu}); return true; }
@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}); }