public void changeLAF(int iLAFIndex) { try { // Change LAF if (iLAFIndex >= marrLaf.length) iLAFIndex = marrLaf.length - 1; UIManager.setLookAndFeel( (LookAndFeel) Class.forName(marrLaf[iLAFIndex].getClassName()).newInstance()); // Update UI ((JMenuItem) mvtLAFItem.elementAt(iLAFIndex)).setSelected(true); SwingUtilities.updateComponentTreeUI(this); SwingUtilities.updateComponentTreeUI(mnuMain); WindowManager.updateLookAndField(); // Store config try { Hashtable prt = Global.loadHashtable(Global.FILE_CONFIG); prt.put("LAF", String.valueOf(iLAFIndex)); Global.storeHashtable(prt, Global.FILE_CONFIG); } catch (Exception e) { } } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
void move() { Entity e; for (int i = 0; i < Entity.entities.size(); ++i) { e = Entity.entities.get(i); float d = Global.distance(x, y, e.x, e.y); if (d < 200 && ((e instanceof Bullet) || (e instanceof Enemy)) && !e.part) { e.xVel -= Global.gravityBombStrength * Math.signum(e.x - x) / (d + 1); e.yVel -= Global.gravityBombStrength * Math.signum(e.y - y) / (d + 1); } } freq++; if (freq == maxFreq) { for (int i = 0; i < Entity.entities.size(); ++i) { e = Entity.entities.get(i); float d = Global.distance(x, y, e.x, e.y); if (d < 200 && ((e instanceof Player) || (e instanceof Enemy))) { e.takeDamage((int) (damage / (1 / d))); } else if (d < 200 && (e instanceof Bullet)) { e.flagDestroy(); } } this.flagDestroy(); ParticleGenerator.generators.add(new ParticleGenerator(x, y, 25, Color.blue)); } }
void $$IMPORTS() { Global.callFxn("loadPackage", xdcO, "xdc"); Global.callFxn("loadPackage", xdcO, "xdc.corevers"); Global.callFxn("loadPackage", xdcO, "xdc.runtime"); Global.callFxn("loadPackage", xdcO, "ti.sysbios.knl"); Global.callFxn("loadPackage", xdcO, "xdc.rov"); }
/** XXX: not right */ public ESBase toPrimitive(int hint) throws Throwable { Global resin = Global.getGlobalProto(); Call eval = resin.getCall(); eval.global = resin.getGlobal(); try { ESBase fun = hasProperty(hint == STRING ? TO_STRING : VALUE_OF); if (fun instanceof ESClosure || fun instanceof Native) { eval.stack[0] = this; eval.top = 1; ESBase value = fun.call(eval, 0); if (value instanceof ESBase && !(value instanceof ESObject)) return value; } fun = hasProperty(hint == STRING ? VALUE_OF : TO_STRING); if (fun instanceof ESClosure || fun instanceof Native) { eval.stack[0] = this; eval.top = 1; ESBase value = fun.call(eval, 0); if (value instanceof ESBase && !(value instanceof ESObject)) return value; } throw new ESException("cannot convert object to primitive type"); } finally { resin.freeCall(eval); } }
public void handleStatement(ASTStatement node) { // System.out.println(node.getCode()); // Drawing connector.startSnap(node.getLineNumber()); // FIXME we'll see how this works // Nested scope for by macro SimpleNode s = (SimpleNode) node.jjtGetChild(0); if (s instanceof ASTStatementList) { System.out.println("This'll never happen"); SymbolTable st = new SymbolTable(Global.getCurrentSymbolTable()); st.setName("nested"); Global.setCurrentSymbolTable(st); s.jjtAccept(this, null); Global.setCurrentSymbolTable(st.getPrevious()); } else { node.jjtGetChild(0).jjtAccept(this, null); if (((SimpleNode) node.jjtGetChild(0)).getId() == JJTCALL) { ((ASTCall) (node.jjtGetChild(0))).setLineNumber(node.getLineNumber()); } update(node.getLineNumber(), UPDATE_REASON_STATEMENT); } // System.out.println("endStatement"); connector.endSnap(); }
void waitForOtherPlayers() throws IOException { Global.log("Waiting for other players to register..."); int n = Integer.parseInt(mainServer.readLine()); playerNames = new String[n]; for (int i = 0; i < n; ++i) { String info = mainServer.readLine(); playerNames[i] = info; } // ping back to server for an OK mainServer.println(); mainServer.flush(); Global.log("List of Players:"); for (int i = 0; i < n; ++i) Global.log("\t" + (i + 1) + ": " + playerNames[i]); // get player ID for (int i = 0; i < n; ++i) { if (name.equals(playerNames[i])) { playerID = i; break; } } Global.log("Player ID: " + (playerID + 1)); }
/** * Global conversion from entity object to jaxb model. * * @param data Global entity object * @return jaxb model of Global */ public static Global transformGlobalToModel(org.kaleta.scheduler.backend.entity.Global data) { Global model = new Global(); Global.Months months = new Global.Months(); for (Integer monthId : data.getMonths().keySet()) { Global.Months.Month month = new Global.Months.Month(); month.setId(String.valueOf(monthId)); month.setOrder(String.valueOf(data.getMonths().get(monthId))); months.getMonthList().add(month); } model.setMonths(months); Global.Tasks tasks = new Global.Tasks(); for (GlobalTask globalTask : data.getTasks()) { Global.Tasks.Task task = new Global.Tasks.Task(); task.setId(String.valueOf(globalTask.getId())); task.setType(globalTask.getType()); task.setDescription(globalTask.getDescription()); task.setPriority(String.valueOf(globalTask.getPriority())); task.setFinished(String.valueOf(globalTask.getFinished())); tasks.getTaskList().add(task); } model.setTasks(tasks); return model; }
void IRtscProductTemplate$$SINGLETONS() { Proto.Obj po; Value.Obj vo; vo = (Value.Obj) om.findStrict("xdc.tools.IRtscProductTemplate", "xdc.tools"); po = (Proto.Obj) om.findStrict("xdc.tools.IRtscProductTemplate.Module", "xdc.tools"); vo.init2(po, "xdc.tools.IRtscProductTemplate", $$DEFAULT, false); vo.bind("Module", po); vo.bind("$category", "Interface"); vo.bind("$capsule", $$UNDEF); vo.bind("$package", om.findStrict("xdc.tools", "xdc.tools")); tdefs.clear(); proxies.clear(); inherits.clear(); vo.bind( "TemplateInfo", om.findStrict("xdc.tools.IRtscProductTemplate.TemplateInfo", "xdc.tools")); tdefs.add(om.findStrict("xdc.tools.IRtscProductTemplate.TemplateInfo", "xdc.tools")); vo.bind("$$tdefs", Global.newArray(tdefs.toArray())); vo.bind("$$proxies", Global.newArray(proxies.toArray())); vo.bind("$$inherits", Global.newArray(inherits.toArray())); ((Value.Arr) pkgV.getv("$interfaces")).add(vo); pkgV.bind("IRtscProductTemplate", vo); ((Value.Arr) pkgV.getv("$unitNames")).add("IRtscProductTemplate"); vo.seal(null); }
public void execute(Context context) { Context exeContext = new Context(); exeContext.mergeVariable(context); Global global = (Global) context.getVariable("global"); Long generateId = global.getGenerateId(); Long userId = global.getUser().getId(); GeneratorInstance generatorInstance = global.getGeneratorInstance(); String generatePath = ConfigProperties.TEMPORARY_PATH + ConfigProperties.fileSeparator + userId + ConfigProperties.fileSeparator + generatorInstance.getName() + "(" + generateId + ")"; String folder = generatePath + ConfigProperties.fileSeparator + this.getName(); folder = Parser.parseString(folder.replace(ConfigProperties.fileSeparator, "/"), exeContext); FileUtil.mkdirs(folder); this.getChildren() .forEach( child -> { child.setParent(this); child.execute(exeContext); }); }
/** Execute the static function */ ESBase execute() throws Throwable { Global resin = (Global) prototype; try { Call call = resin.getCall(); call.caller = call; call.setArg(0, this); call.top = 1; call.scopeLength = 1; call.scope[0] = this; call.global = this; ESBase value = null; try { value = call(0, call, 0); } finally { resin.freeCall(call); } return value; } catch (ESException e) { throw e; } catch (Throwable e) { throw new ESWrapperException(e); } }
void $$IMPORTS() { Global.callFxn("loadPackage", xdcO, "xdc.bld"); Global.callFxn("loadPackage", xdcO, "gnu.targets"); Global.callFxn("loadPackage", xdcO, "xdc"); Global.callFxn("loadPackage", xdcO, "xdc.corevers"); Global.callFxn("loadPackage", xdcO, "google.targets"); }
private void updateDeadlineDescription() { try { global.Deadline = global.con.createStatement(); global.DeadlineRS = global.Deadline.executeQuery("SELECT * FROM deadlines WHERE ActivityID = " + activityID); if (global.DeadlineRS.first()) { global.Deadline.executeUpdate( "UPDATE deadlines SET " + "Description = '" + DescriptionTextBox.getText().toString().replaceAll("'", "''") + "' " + "WHERE ActivityID = " + activityID); } } catch (SQLException ex) { StringWriter error = new StringWriter(); ex.printStackTrace(new PrintWriter(error)); SystemCrashDialog crash = new SystemCrashDialog( global.root, true, global, global.root.getHeaderRootPanel1().getClientComboBox().getSelectedItem().toString(), global.root.getHeaderRootPanel1().getMatterComboBox().getSelectedItem().toString(), "Err0225", error.toString()); } }
void Main$$TYPES() { Scriptable cap; Proto.Obj po; Proto.Str ps; Proto.Typedef pt; Object fxn; cap = (Scriptable) Global.callFxn("loadCapsule", xdcO, "xdc/tools/cdoc/sg/Main.xs"); om.bind("xdc.tools.cdoc.sg.Main$$capsule", cap); po = (Proto.Obj) om.findStrict("xdc.tools.cdoc.sg.Main.Module", "xdc.tools.cdoc.sg"); po.init("xdc.tools.cdoc.sg.Main.Module", $$Module); po.addFld("$hostonly", $$T_Num, 1, "r"); fxn = Global.get(cap, "module$use"); if (fxn != null) om.bind("xdc.tools.cdoc.sg.Main$$module$use", true); if (fxn != null) po.addFxn("module$use", $$T_Met, fxn); fxn = Global.get(cap, "module$meta$init"); if (fxn != null) om.bind("xdc.tools.cdoc.sg.Main$$module$meta$init", true); if (fxn != null) po.addFxn("module$meta$init", $$T_Met, fxn); fxn = Global.get(cap, "module$validate"); if (fxn != null) om.bind("xdc.tools.cdoc.sg.Main$$module$validate", true); if (fxn != null) po.addFxn("module$validate", $$T_Met, fxn); po.addFxn( "main", (Proto.Fxn) om.findStrict("xdc.tools.cdoc.sg.Main$$main", "xdc.tools.cdoc.sg"), Global.get(cap, "main")); }
void ICmd$$SINGLETONS() { Proto.Obj po; Value.Obj vo; vo = (Value.Obj) om.findStrict("xdc.tools.ICmd", "xdc.tools"); po = (Proto.Obj) om.findStrict("xdc.tools.ICmd.Module", "xdc.tools"); vo.init2(po, "xdc.tools.ICmd", $$DEFAULT, false); vo.bind("Module", po); vo.bind("$category", "Interface"); vo.bind("$capsule", om.findStrict("xdc.tools.ICmd$$capsule", "xdc.tools")); vo.bind("Instance", om.findStrict("xdc.tools.ICmd.Instance", "xdc.tools")); vo.bind("Params", om.findStrict("xdc.tools.ICmd.Params", "xdc.tools")); vo.bind( "PARAMS", ((Proto.Str) om.findStrict("xdc.tools.ICmd.Params", "xdc.tools")).newInstance()); vo.bind("$package", om.findStrict("xdc.tools", "xdc.tools")); tdefs.clear(); proxies.clear(); inherits.clear(); vo.bind("$$tdefs", Global.newArray(tdefs.toArray())); vo.bind("$$proxies", Global.newArray(proxies.toArray())); vo.bind("$$inherits", Global.newArray(inherits.toArray())); ((Value.Arr) pkgV.getv("$interfaces")).add(vo); pkgV.bind("ICmd", vo); ((Value.Arr) pkgV.getv("$unitNames")).add("ICmd"); vo.seal(null); }
void $$SINGLETONS() { pkgP.init( "xdc.services.mapping.Package", (Proto.Obj) om.findStrict("xdc.IPackage.Module", "xdc.services.mapping")); pkgP.bind("$capsule", $$UNDEF); pkgV.init2(pkgP, "xdc.services.mapping", Value.DEFAULT, false); pkgV.bind("$name", "xdc.services.mapping"); pkgV.bind("$category", "Package"); pkgV.bind("$$qn", "xdc.services.mapping."); pkgV.bind("$vers", Global.newArray(1, 0, 0)); Value.Map atmap = (Value.Map) pkgV.getv("$attr"); atmap.seal("length"); imports.clear(); pkgV.bind("$imports", imports); StringBuilder sb = new StringBuilder(); sb.append("var pkg = xdc.om['xdc.services.mapping'];\n"); sb.append("if (pkg.$vers.length >= 3) {\n"); sb.append("pkg.$vers.push(Packages.xdc.services.global.Vers.getDate(xdc.csd() + '/..'));\n"); sb.append("}\n"); sb.append("if ('xdc.services.mapping$$stat$base' in xdc.om) {\n"); sb.append("pkg.packageBase = xdc.om['xdc.services.mapping$$stat$base'];\n"); sb.append("pkg.packageRepository = xdc.om['xdc.services.mapping$$stat$root'];\n"); sb.append("}\n"); sb.append("pkg.build.libraries = [\n"); sb.append("];\n"); sb.append("pkg.build.libDesc = [\n"); sb.append("];\n"); Global.eval(sb.toString()); }
public void changeDictionary(String strLanguage) { // Change dictionary MonitorDictionary.setCurrentLanguage(strLanguage); DefaultDictionary.setCurrentLanguage(strLanguage); ErrorDictionary.setCurrentLanguage(strLanguage); // Update UI updateLanguage(); WindowManager.updateLanguage(); int iIndex = mvtLanguage.indexOf(strLanguage); if (iIndex >= 0) { JRadioButtonMenuItem mnu = (JRadioButtonMenuItem) mvtLanguageItem.elementAt(iIndex); mnu.setSelected(true); } // Store config Hashtable prt = null; try { prt = Global.loadHashtable(Global.FILE_CONFIG); } catch (Exception e) { prt = new Hashtable(); } prt.put("Language", strLanguage); try { Global.storeHashtable(prt, Global.FILE_CONFIG); } catch (Exception e) { } }
private int compare(ESBase cmp, ESBase a, ESBase b) throws Throwable { if (a == b) return 0; else if (a == esUndefined) return 1; else if (b == esUndefined) return -1; else if (a == esNull) return 1; else if (b == esNull) return -1; else if (cmp != null) { // Call eval = new Call(ESGlobal.getGlobalProto(), false); Global resin = Global.getGlobalProto(); Call eval = resin.getCall(); eval.stack[0] = esNull; eval.stack[1] = a; eval.stack[2] = b; eval.top = 1; int result = cmp.call(eval, 2).toInt32(); resin.freeCall(eval); return result; } else { String sa = a.toString(); String sb = b.toString(); return sa.compareTo(sb); } }
void $$SINGLETONS() { pkgP.init( "ti.sdo.ce.utils.rtcfg.osal.Package", (Proto.Obj) om.findStrict("xdc.IPackage.Module", "ti.sdo.ce.utils.rtcfg.osal")); pkgP.bind("$capsule", $$UNDEF); pkgV.init2(pkgP, "ti.sdo.ce.utils.rtcfg.osal", Value.DEFAULT, false); pkgV.bind("$name", "ti.sdo.ce.utils.rtcfg.osal"); pkgV.bind("$category", "Package"); pkgV.bind("$$qn", "ti.sdo.ce.utils.rtcfg.osal."); pkgV.bind("$vers", Global.newArray("1, 0, 0")); Value.Map atmap = (Value.Map) pkgV.getv("$attr"); atmap.seal("length"); imports.clear(); pkgV.bind("$imports", imports); StringBuilder sb = new StringBuilder(); sb.append("var pkg = xdc.om['ti.sdo.ce.utils.rtcfg.osal'];\n"); sb.append("if (pkg.$vers.length >= 3) {\n"); sb.append("pkg.$vers.push(Packages.xdc.services.global.Vers.getDate(xdc.csd() + '/..'));\n"); sb.append("}\n"); sb.append("pkg.build.libraries = [\n"); sb.append("];\n"); sb.append("pkg.build.libDesc = [\n"); sb.append("];\n"); Global.eval(sb.toString()); }
@Test public void testGetCustomParameter() throws Exception { Global.customParameter = "a=1,bcd=2, c=3"; Assert.assertEquals(Global.getCustomParameter().get("a"), "1"); Assert.assertEquals(Global.getCustomParameter().get("bcd"), "2"); Assert.assertEquals(Global.getCustomParameter().get("c"), "3"); }
public UIDeath(GameContainer gc) { this.backgroundTransparency = 0.7f; this.menuBackgroundTransparency = 0.3f; this.display = new Display(gc); // Background image this.menuBackgroundImage = Global.setImage("1770925_s.jpg"); // You lost label Image gameOverImage = Global.setImage("blur11.jpg").getScaledCopy(DEATH_W - 2 * BUTTON_SPACE, BUTTON_H); Label gameOver = new Label(gameOverImage, "Vous etes morts!\n"); gameOver.setBounds( BUTTON_X, DEATH_Y + DEATH_H / 3 - BUTTON_H, DEATH_W - 2 * BUTTON_SPACE, BUTTON_H); gameOver.setForeground(Color.black); gameOver.pack(); this.display.add(gameOver); gameOver.setImage(null); // Restart button //TODO: Button Image buttonImage = Global.setImage("blur11.jpg").getScaledCopy(BUTTON_W, BUTTON_H); Label restartLabel = new Label(buttonImage, "Recommencer"); restartLabel.setBounds(BUTTON_X, BUTTON_Y, BUTTON_W, BUTTON_H); restartLabel.pack(); this.display.add(restartLabel); // Back button //TODO: Button Label backToMenuLabel = new Label(buttonImage, "Menu principal"); backToMenuLabel.setBounds(BUTTON_X + BUTTON_W + BUTTON_SPACE, BUTTON_Y, BUTTON_W, BUTTON_H); backToMenuLabel.pack(); this.display.add(backToMenuLabel); }
private void GenerateReportButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_GenerateReportButtonActionPerformed global.letterDollarAmount = "$" + DollarAmountTextBox.getText().toString(); GenerateLetter letter = new GenerateLetter(); letter.generateLetter(global, name); global.lastLetterFile = letter.newFilePath; this.dispose(); } // GEN-LAST:event_GenerateReportButtonActionPerformed
void Agent$$TYPES() { Scriptable cap; Proto.Obj po; Proto.Str ps; Proto.Typedef pt; Object fxn; cap = (Scriptable) Global.callFxn("loadCapsule", xdcO, "ti/sysbios/rta/Agent.xs"); om.bind("ti.sysbios.rta.Agent$$capsule", cap); po = (Proto.Obj) om.findStrict("ti.sysbios.rta.Agent.Module", "ti.sysbios.rta"); po.init("ti.sysbios.rta.Agent.Module", $$Module); po.addFld("$hostonly", $$T_Num, 1, "r"); po.addFld("loadLogging", $$T_Bool, true, "wh"); po.addFld("loadLoggingRuntimeControl", $$T_Bool, true, "wh"); po.addFld("loadLoggerSize", Proto.Elm.newCNum("(xdc_SizeT)"), 512L, "wh"); po.addFld("loadLoggerBufferSection", $$T_Str, "[Default]", "wh"); po.addFld("mainLogging", $$T_Bool, true, "wh"); po.addFld("mainLoggingRuntimeControl", $$T_Bool, true, "wh"); po.addFld("mainLoggerSize", Proto.Elm.newCNum("(xdc_SizeT)"), 1024L, "wh"); po.addFld("mainLoggerBufferSection", $$T_Str, "[Default]", "wh"); po.addFld("sysbiosHwiLogging", $$T_Bool, false, "wh"); po.addFld("sysbiosHwiLoggingRuntimeControl", $$T_Bool, false, "wh"); po.addFld("sysbiosSwiLogging", $$T_Bool, false, "wh"); po.addFld("sysbiosSwiLoggingRuntimeControl", $$T_Bool, false, "wh"); po.addFld("sysbiosTaskLogging", $$T_Bool, true, "wh"); po.addFld("sysbiosTaskLoggingRuntimeControl", $$T_Bool, true, "wh"); po.addFld("sysbiosLoggerSize", Proto.Elm.newCNum("(xdc_SizeT)"), 4096L, "wh"); po.addFld("sysbiosLoggerBufferSection", $$T_Str, "[Default]", "wh"); po.addFld("configureSystemLog", $$T_Bool, true, "wh"); po.addFld("numSystemRecords", Proto.Elm.newCNum("(xdc_Int)"), 64L, "wh"); po.addFld("configureLoadLog", $$T_Bool, true, "wh"); po.addFld("numLoadRecords", Proto.Elm.newCNum("(xdc_Int)"), 64L, "wh"); po.addFld("periodInMs", Proto.Elm.newCNum("(xdc_Int)"), 100L, "wh"); po.addFld("priority", Proto.Elm.newCNum("(xdc_Int)"), 1L, "wh"); po.addFld("agentStackSize", Proto.Elm.newCNum("(xdc_SizeT)"), 1024L, "wh"); po.addFld("agentStackSection", $$T_Str, "[Default]", "wh"); po.addFld("transferBufferSize", Proto.Elm.newCNum("(xdc_Int)"), 85L, "wh"); po.addFld("transferBufferSection", $$T_Str, $$UNDEF, "wh"); po.addFld("addSupportLogger", $$T_Bool, true, "wh"); po.addFld("supportControl", $$T_Bool, true, "wh"); po.addFld( "transport", (Proto) om.findStrict("ti.sysbios.rta.Agent.Transport", "ti.sysbios.rta"), om.find("ti.sysbios.rta.Agent.Transport_STOP_MODE_ONLY"), "wh"); po.addFld("dataStream", $$T_Str, "/rtdx0", "wh"); po.addFld("commandStream", $$T_Str, "/rtdx1", "wh"); po.addFld("responseStream", $$T_Str, "/rtdx1", "wh"); fxn = Global.get(cap, "module$use"); if (fxn != null) om.bind("ti.sysbios.rta.Agent$$module$use", true); if (fxn != null) po.addFxn("module$use", $$T_Met, fxn); fxn = Global.get(cap, "module$meta$init"); if (fxn != null) om.bind("ti.sysbios.rta.Agent$$module$meta$init", true); if (fxn != null) po.addFxn("module$meta$init", $$T_Met, fxn); fxn = Global.get(cap, "module$validate"); if (fxn != null) om.bind("ti.sysbios.rta.Agent$$module$validate", true); if (fxn != null) po.addFxn("module$validate", $$T_Met, fxn); }
@Override protected String doInBackground(String... arg0) { File dir = new File(this.dirName); if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { new File(dir, children[i]).delete(); } } String urlAdress = this.pathName; String jString = null; try { File root = new File("/sdcard/Vatan"); root.mkdir(); File directory = new File(this.dirName); directory.mkdir(); URL url; url = new URL(urlAdress); URLConnection ucon = url.openConnection(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while ((current = bis.read()) != -1) { baf.append((byte) current); } jString = new String(baf.toByteArray()); Gson gson = new Gson(); SearchResponse response = gson.fromJson(jString, SearchResponse.class); List<Result> results = response.root; String[] urlAdress1 = null; for (Result result : results) { // values[0][0][0]=result.ImageURL; if (!result.ImageURL.equals("")) { urlAdress1 = result.ImageURL.split("/"); Global.DownloadFile( Global.resizeImageURL(result.ImageURL, "133", "0"), urlAdress1[urlAdress1.length - 1], this.dirName); } } return jString; } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); return "hata1"; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return "hata1"; } }
@Override public boolean onOptionsItemSelected(MenuItem item) { int br = 1; switch (item.getItemId()) { case R.id.menu_settings: Intent i = new Intent(this, UserSettingActivity.class); startActivityForResult(i, RESULT_SETTINGS); break; case R.id.menu_upload: if (global.getLogin() != null) { brands = db.retriveBrand(); for (Brand bra : brands) { if (bra.getBrandStatus().equals("true")) { ++br; } } uploadList = db.retriveUpload(); if (br >= 2) { if (connection.isConnectingToInternet()) { try { new Load().execute(uploadList); } catch (Exception e) { // TODO: handle exception } Editor edit = preference.edit(); edit.putInt("upload", 2); edit.putInt("playMode", 2); edit.clear(); edit.commit(); db.resetTables(MySQLiteHelper.TABLE_NAME); db.resetTables(MySQLiteHelper.server_table); global.setLogin(null); Toast.makeText(home.this, "success", Toast.LENGTH_LONG).show(); finish(); } else { alert.showAlertDialog(home.this, "Warning", "Check your network connection", true); } } else { alert.showAlertDialog(home.this, "Warning", "You need to play atleast two brand", true); } } else { { Constants.name = preference.getString("name", null); Constants.age = preference.getString("age", null); Constants.gender = preference.getString("gender", null); if (Constants.name != null && Constants.age != null && Constants.gender != null) new InsertData().execute(); else alert.showAlertDialog( home.this, "Warning", "You are not logged in and no data to upload", true); } } break; } return true; }
public Exporter() { profile = Global.getProfile(); pref = Global.getPref(); cacheDB = profile.cacheDB; howManyParams = LAT_LON; expName = this.getClass().getName(); // remove package expName = expName.substring(expName.indexOf(".") + 1); }
/** Called when the module is enabled. */ public void onEnable() { Global.PLUGIN = m_plugin; Global.MODULE = this; register(m_playerListener); Global.LoadConfig(); Global.OutputConsole("Module Enabled"); }
/** Called when the user clicks the Send button */ public void showMovies(View view) { Global global = ((Global) getApplicationContext()); Intent intent = new Intent(this, MovieShowings.class); intent.putExtra(SELECTED_VENUE_ID, selVenueID); intent.putExtra(SELECTED_VENUE_NAME, selVenueName); intent.putExtra(SELECTED_VENUE_LAT, selVenueLat); intent.putExtra(SELECTED_VENUE_LNG, selVenueLng); global.set_venue(selVenueID); startActivity(intent); }
@AfterViews protected void initTermsActivity() { Global.initWebView(webView); try { webView.loadDataWithBaseURL( null, Global.readTextFile(getAssets().open("terms.html")), "text/html", "UTF-8", null); } catch (Exception e) { Global.errorLog(e); } }
@Override public View getView(int position, View adapterView, ViewGroup parent) { Ctrl_WeatherData.Forecast listItem = (Ctrl_WeatherData.Forecast) listData.get(position); Element_Linear_Vertical adapterElement = new Element_Linear_Vertical(); Element_Standard time = new Element_Standard("Forecast"); Element_Standard temperature = new Element_Standard("Temp", "°C"); Element_Standard temperatureMinMax = new Element_Standard("Min/Max"); Element_Standard precipitationValue = new Element_Standard("Precip", "mm"); Element_Standard precipitationType = new Element_Standard(""); Element_Standard windSpeed = new Element_Standard("Wind", "m/s"); Element_Standard windName = new Element_Standard(""); Element_Standard windDirection = new Element_Standard(""); Element_Standard cloudAll = new Element_Standard("Clouds", "%"); Element_Standard cloudValue = new Element_Standard(""); adapterElement.insertPoint.addView(time); adapterElement.insertPoint.addView(temperature); adapterElement.insertPoint.addView(temperatureMinMax); adapterElement.insertPoint.addView(precipitationValue); adapterElement.insertPoint.addView(precipitationType); adapterElement.insertPoint.addView(windSpeed); adapterElement.insertPoint.addView(windName); adapterElement.insertPoint.addView(windDirection); adapterElement.insertPoint.addView(cloudAll); adapterElement.insertPoint.addView(cloudValue); String day = Global.displayDayOfWeek((listItem.dateTime.from)); String time_from = Global.displayTimeShort(listItem.dateTime.from); String time_to = Global.displayTimeShort(listItem.dateTime.to); time.setValue(time_from + " - " + time_to); temperature.setValue(listItem.temperature.value); temperatureMinMax.setValue( Math.round(listItem.temperature.min) + "/" + Math.round(listItem.temperature.max)); if (listItem.precipitation != null) { precipitationValue.setValue( listItem.precipitation.value); // + listItem.precipitation.unit); precipitationType.setValue(listItem.precipitation.type); } windSpeed.setValue(listItem.windSpeed.speed); windName.setValue(listItem.windSpeed.name); windDirection.setValue(listItem.windDirection.code); cloudAll.setValue(listItem.clouds.all); cloudValue.setValue(listItem.clouds.value); if (position % 2 == 0) { adapterElement.setBackground(0x800000ff); // BLUE = (0xff0000ff) (first byte = intensity) } if ((listItem.dateTime.from < Global.now()) && (listItem.dateTime.to > Global.now())) { adapterElement.setBackground(Color.BLACK); } return adapterElement; }
void $$INITIALIZATION() { Value.Obj vo; if (isCFG) {} // isCFG Global.callFxn( "module$meta$init", (Scriptable) om.findStrict("ti.platforms.evm6424.Platform", "ti.platforms.evm6424")); Global.callFxn("init", pkgV); ((Value.Obj) om.getv("ti.platforms.evm6424.Platform")).bless(); ((Value.Arr) om.findStrict("$packages", "ti.platforms.evm6424")).add(pkgV); }