public void leaveGroup(String idRoom) { int n = 0; ChatScreen cs; TombolRoomField trf; for (n = 0; n < chatss.length; n++) { cs = chatss[n]; if (cs != null) if (cs.getIdRoom().equals(idRoom)) { this.chatss[n] = null; break; } } for (n = 0; n < AktifRoom.getFieldCount(); n++) { trf = (TombolRoomField) AktifRoom.getField(n); if (trf.getRoom().getIdRoom().equals(idRoom)) { AktifRoom.delete(trf); } } PushController.updateIndicator(false); InetConn.getWebData( Util.GetURLChat() + "inout.php?id=" + idRoom + "&pin=" + pin + "&in=false&nick=" + DBStor.get_setting().getNick(), new WebDataCallback() { public void callback(String data) {} }); cs = null; trf = null; }
protected void createScreenContents(VerticalFieldManager manager) { LabelField logDescription = new LabelField("Application log:", USE_ALL_WIDTH); manager.add(logDescription); log = new LabelField("", USE_ALL_WIDTH); logContainer.setListener(this); log.setText(logContainer.toString()); manager.add(log); }
public void refresh() { vfm.deleteAll(); for (int i = 0; i < logEntries.size(); i++) { LogEntryField curr = (LogEntryField) logEntries.elementAt(i); if (Level.isGreaterOrEqual(curr.getLogLevel(), displayLevel)) { vfm.add(curr); } } }
protected void paintBackground(Graphics g) { // paint my bubble int col = g.getColor(); int height = this.getContentHeight(); // int width = this.getContentWidth(); int width = this.getWidth(); // draw corners g.drawBitmap(0, 0, 17, 17, blue_bubble, 0, 0); // left top g.drawBitmap(width - 11, 0, 10, 10, blue_bubble, 36, 0); // right top g.drawBitmap(0, height - 11, 17, 11, blue_bubble, 0, 17); // left bottom g.drawBitmap(width - 11, height - 11, 11, 11, blue_bubble, 36, 17); // right bottom // draw borders g.tileRop(Graphics.ROP_SRC_ALPHA, 17, 0, width - 27, 9, blue_top_bar, 0, 0); g.tileRop(Graphics.ROP_SRC_ALPHA, 7, 17, 10, height - 28, blue_left_bar, 0, 0); g.tileRop(Graphics.ROP_SRC_ALPHA, 17, height - 11, width - 27, 11, blue_bottom_bar, 0, 0); g.tileRop(Graphics.ROP_SRC_ALPHA, width - 15, 10, 9, height - 21, blue_right_bar, 0, 0); // draw inside bubble // g.tileRop(Graphics.ROP_SRC_ALPHA, 17, 10, width-27, height-19, grey_inside_bubble, 0, 0); g.setColor(0x00FAFAFA); g.fillRect(17, 9, width - 28, height - 19); g.setColor(col); super.paintBackground(g); }
public void clearLog() { if (vfm != null) { vfm.deleteAll(); } if (logEntries != null) { logEntries.removeAllElements(); } }
public void addToActive(TombolRoomField tf) { if (!DBStor.get_setting().isTest() && !DeviceInfo.isSimulator()) { Dialog.alert("Please try Test Push, until get Success notification."); return; } PushController.updateIndicator(false); if (Integer.parseInt(tf.getTotalperson()) > 49) { Dialog.alert("Room Full!"); } int n = 0, a = 0; for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css != null) { a++; } } if (a < 5) { ChatScreen cs; for (n = 0; n < chatss.length; n++) { cs = chatss[n]; if (cs != null) { if (cs.getIdRoom().equals(tf.getRoom().getIdRoom())) { UiApplication.getUiApplication().pushScreen(cs); return; } } } TombolRoomField tfs = new TombolRoomField(tf.getRoom(), "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setActive(true); AktifRoom.add(tfs); cs = new ChatScreen(tf.getRoom().getIdRoom(), tfs.getLabel(), this, tfs); for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css == null) { this.chatss[n] = cs; break; } } UiApplication.getUiApplication().pushScreen(cs); cs = null; } else { ChatScreen cs; for (n = 0; n < chatss.length; n++) { cs = chatss[n]; if (cs != null) { if (cs.getIdRoom().equals(tf.getRoom().getIdRoom())) { UiApplication.getUiApplication().pushScreen(cs); return; } } } Dialog.alert("Max 5 Active Room"); } }
public void sublayout(int width, int height) { if (managerWidth == 0) { managerWidth = width; } if (managerHeight == 0) { managerHeight = height; } super.sublayout(managerWidth, managerHeight); setExtent(managerWidth, managerHeight); }
public ChatBoxTextBoxField(int width, int height, long style) { super(Manager.NO_VERTICAL_SCROLL | style); managerWidth = width; managerHeight = height; VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL); editField = new EditField() { public void paint(Graphics g) { getManager().invalidate(); super.paint(g); } }; editField.setNonSpellCheckable(true); vfm.setPadding(10, 20, 10, 20); vfm.add(editField); add(vfm); }
public void showUserAsync(String pUserId) { try { fb.getUser( pUserId, new AsyncCallbackAdapter() { public void onComplete( com.blackberry.facebook.model.IObject[] objects, final java.lang.Object state) { user = (IUser) objects[0]; UiApplication.getApplication() .invokeLater( new Runnable() { public void run() { setTitle( new LabelField( "Hello " + user.getName() + " !", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); vfm2.deleteAll(); vfm2.add(new LabelField("id = " + user.getId())); vfm2.add(new LabelField("name = " + user.getName())); vfm2.add(new LabelField("email = " + user.getEmail())); vfm2.add(new LabelField("birthday = " + user.getBirthdayAsString())); vfm2.add( new LabelField("updated_time = " + user.getUpdatedTimeAsString())); } }); } public void onException(final Exception e, final java.lang.Object state) { e.printStackTrace(); UiApplication.getApplication() .invokeLater( new Runnable() { public void run() { setTitle( new LabelField( "Error Encountered", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); vfm2.deleteAll(); vfm2.add(new LabelField("Exception: " + e.getMessage())); } }); } }, null); } catch (FacebookException e) { e.printStackTrace(); } setTitle(new LabelField("Retrieving...", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); vfm2.deleteAll(); vfm2.add(new LabelField("id = ...")); vfm2.add(new LabelField("name = ...")); vfm2.add(new LabelField("email = ...")); vfm2.add(new LabelField("birthday = ...")); vfm2.add(new LabelField("updated_time = ...")); add(vfm2); }
private void create() { VerticalFieldManager groupManager = GuiUtills.getMainLayout(); Vector records = result.getRecords(); for (int j = 0; j < records.size(); j++) { final Record record = (Record) records.elementAt(j); RecordCellsField recordField = new RecordCellsField(record); recordField.setListener(listener); groupManager.add(recordField); recordField.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { recordSelected(record); } }); } this.add(groupManager); }
/** Creates a new BasicScrollingScreen object */ public BasicScrollingScreen() { super(NO_VERTICAL_SCROLL | USE_ALL_WIDTH); setTitle("Basic Scrolling Screen"); // Add a field which will not scroll add(new CustomField(Color.WHITE, "This field does not scroll")); // Create a scrollable VerticalFieldManager final VerticalFieldManager scrollingRegion = new VerticalFieldManager(USE_ALL_HEIGHT | VERTICAL_SCROLL | VERTICAL_SCROLLBAR); // Add fields to the scrollable region, alternating background color for (int i = 0; i < 15; ++i) { final int color = colors[i % 2]; scrollingRegion.add( new CustomField(color, i + 1 + " - This field is in the scrolling region")); } // Add the VerticalfieldManager to the screen add(scrollingRegion); }
public void callback(String data) { Util.Log("rooms" + data); setShowLoader(false); if (data.startsWith("Exception")) { Dialog.alert("Failed to connect to server."); } else if (data.startsWith("room:")) { String[] temps = Util.split(data.substring(5), "<room>"); for (int n = 0; n < temps.length; n++) { String[] temp = Util.split(temps[n], "||"); reloadActive(new RoomChat(temp[1], temp[0])); } // reloadActive(); setShowLoader(true); if (DeviceInfo.isSimulator()) { callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon()); } else { LBS.getLocation(this); } } else if (data.startsWith("empty")) { if (DeviceInfo.isSimulator()) { callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon()); } else { LBS.getLocation(this); } } else if (data.startsWith("done:")) { ChatRoom.deleteAll(); String temps[] = Util.split(data.substring(5), "<<>>"); String temp[]; for (int n = 0; n < temps.length; n++) { temp = Util.split(temps[n], "||"); TombolRoomField tl = new TombolRoomField(new RoomChat(temp[1], temp[0]), temp[2], USE_ALL_WIDTH); tl.setChangeListener(this); ChatRoom.add(tl); } } }
public void removeFromFav(RoomChat rc, TombolRoomField field) { int n = 0; RoomChat tf2; for (n = 0; n < favRomm.size(); n++) { tf2 = (RoomChat) favRomm.elementAt(n); if (tf2.getIdRoom().equals(rc.getIdRoom())) { favRomm.removeElementAt(n); favRomm.trimToSize(); DBStor.set_roomFav(favRomm); break; } } Favourite.delete(field); }
public Manager splashScreen(Manager parent) { VerticalFieldManager fm_MainHolder = new VerticalFieldManager( Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT | Manager.NO_VERTICAL_SCROLL) { public int getPreferredWidth() { return Display.getWidth(); } public int getPreferredHeight() { return Display.getHeight(); } protected void sublayout(int width, int height) { width = getPreferredWidth(); height = getPreferredHeight(); super.sublayout(width, height); super.setExtent(width, height); } }; Background back = bkg_splash; fm_MainHolder.setBackground(back); parent.add(fm_MainHolder); return fm_MainHolder; }
public EditorScreen(final Bitmap gbr, String path, String filename) { super(NO_VERTICAL_SCROLL); this.path = path; this.filename = filename; this.gbr = gbr; this.g = Graphics.create(gbr); UiApplication.getUiApplication().requestForeground(); latar = new VerticalFieldManager( VERTICAL_SCROLL | HORIZONTAL_SCROLL | USE_ALL_WIDTH | USE_ALL_HEIGHT) { protected void paint(Graphics graphics) { graphics.drawBitmap(0, 0, gbr.getWidth(), gbr.getHeight(), gbr, 0, 0); graphics.drawRect(0, 0, gbr.getWidth(), gbr.getHeight()); super.paint(graphics); } }; this.gbrfield = new gbrField(gbr.getWidth(), gbr.getHeight()); latar.add(gbrfield); gbrfield.setText("Jalak_Harupat"); add(latar); addMenuItem(addText); addMenuItem(addArrow); addMenuItem(addimg); addMenuItem(addFilter); addMenuItem(addhelp); addMenuItem(saveclose); addMenuItem(about); if (DBStor.getSettings() == null) { UiApplication.getUiApplication() .invokeLater( new Runnable() { public void run() { Dialog.alert("this is editor Screen, Click menu to do something."); } }); DBStor.setSettings(new Settings()); } setDirty(true); }
public void addToFav(TombolRoomField tf) { int n = 0; RoomChat tf2; boolean ada = false; for (n = 0; n < favRomm.size(); n++) { tf2 = (RoomChat) favRomm.elementAt(n); if (tf2.getIdRoom().equals(tf.getRoom().getIdRoom())) { ada = true; break; } } if (ada) { Dialog.alert("Room Chat exist"); } else { favRomm.addElement(tf.getRoom()); DBStor.set_roomFav(favRomm); TombolRoomField tfs = new TombolRoomField(tf.getRoom(), "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setFavourite(true); Favourite.add(tfs); } }
public void showUserSync(String pUserId) { try { user = fb.getUser(pUserId); setTitle( new LabelField( "Hello " + user.getName() + " !", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); vfm2.deleteAll(); vfm2.add(new LabelField("id = " + user.getId())); vfm2.add(new LabelField("name = " + user.getName())); vfm2.add(new LabelField("email = " + user.getEmail())); vfm2.add(new LabelField("birthday = " + user.getBirthdayAsString())); vfm2.add(new LabelField("updated_time = " + user.getUpdatedTimeAsString())); add(vfm2); } catch (Exception e) { e.printStackTrace(); setTitle(new LabelField("Error Encountered", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); vfm2.deleteAll(); vfm2.add(new LabelField("Exception: " + e.getMessage())); add(vfm2); } finally { } }
public void reloadActive(RoomChat tf) { int n = 0, a = 0; for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css != null) { a++; } } if (a < 5) { ChatScreen cs; for (n = 0; n < chatss.length; n++) { ChatScreen f2 = chatss[n]; if (f2 != null) if (f2.getIdRoom().equals(tf.getIdRoom())) { return; } } TombolRoomField tfs = new TombolRoomField(tf, "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setActive(true); AktifRoom.add(tfs); cs = new ChatScreen(tf.getIdRoom(), tf.getNamaRoom(), this, tfs); // UiApplication.getUiApplication().pushScreen(cs); for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css == null) { this.chatss[n] = cs; break; } } cs = null; } else { // Dialog.alert("Max 5 Room active"); } }
public void run() { int ask = -1; if (undo != null) ask = Dialog.ask( "What Filter?", new String[] {"GrayScale", "Negative", "Sephia", "Termal", "Undo Filter"}, 0); else ask = Dialog.ask( "What Filter?", new String[] {"GrayScale", "Negative", "Sephia", "Termal"}, 0); if (ask < 4) { undo = new int[gbr.getWidth() * gbr.getHeight()]; gbr.getARGB(undo, 0, gbr.getWidth(), 0, 0, gbr.getWidth(), gbr.getHeight()); FilterImg.doit(gbr, ask); } else if (ask == 4) { if (undo != null) { gbr.setARGB(undo, 0, gbr.getWidth(), 0, 0, gbr.getWidth(), gbr.getHeight()); undo = null; } } latar.invalidate(); }
public Manager mainScreen(Manager parent) { CInterface ci = new CInterface(); final int columnHeight0 = (int) ((Display.getHeight() / 2)); final int columnHeight1 = (int) (Display.getHeight() / 2); final int btnw = (int) ((float) Display.getWidth() * .75); final EncodedImage buttonoff = ci.getScaledImage(EncodedImage.getEncodedImageResource(button), btnw); final EncodedImage buttonon = ci.getScaledImage(EncodedImage.getEncodedImageResource(button_on), btnw); final EncodedImage friendsoff = ci.getScaledImage(EncodedImage.getEncodedImageResource(friends), btnw); final EncodedImage friendson = ci.getScaledImage(EncodedImage.getEncodedImageResource(friends_on), btnw); int imagew = (int) ((float) Display.getWidth() * .75); Bitmap blankbmp = Bitmap.getBitmapResource(blank); VerticalFieldManager fm_MainHolder = new VerticalFieldManager( Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT | Manager.NO_HORIZONTAL_SCROLL | Manager.NO_VERTICAL_SCROLL) { public int getPreferredWidth() { return Display.getWidth(); } public int getPreferredHeight() { return Display.getHeight(); } protected void sublayout(int width, int height) { width = getPreferredWidth(); height = getPreferredHeight(); super.sublayout(width, height); super.setExtent(width, height); } }; Background back = bkg_main; fm_MainHolder.setBackground(back); // MAIN LOGO HorizontalFieldManager lgo = new HorizontalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL | Manager.FIELD_HCENTER | Manager.FIELD_VCENTER | Manager.USE_ALL_WIDTH) { public int getPreferredHeight() { return columnHeight0; } protected void sublayout(int width, int height) { width = super.getPreferredWidth(); height = getPreferredHeight(); super.sublayout(width, height); super.setExtent(width, height); } }; BitmapField img = ci.WriteSimpleImage( lgo, logo, BitmapField.FIELD_VCENTER | BitmapField.FIELD_HCENTER, imagew, ""); fm_MainHolder.add(lgo); // BUTTON HOLDER VerticalFieldManager vfmButton = new VerticalFieldManager( Manager.FIELD_HCENTER | Manager.FIELD_VCENTER | Manager.USE_ALL_WIDTH) { public int getPreferredHeight() { return columnHeight1; } public int getPreferredWidth() { return Display.getWidth(); } protected void sublayout(int width, int height) { width = getPreferredWidth(); height = getPreferredHeight(); super.sublayout(width, height); super.setExtent(width, height); } }; final BitmapField bmFieldSpan = new BitmapField(blankbmp, BitmapField.NON_FOCUSABLE); CustomButtonField cbfFriends = new CustomButtonField( btnw, strings.getString("invite_friends"), friendsoff.getBitmap(), friendson.getBitmap(), Field.FOCUSABLE | Field.FIELD_HCENTER | Field.FIELD_VCENTER) { protected boolean navigationClick(int status, int time) { c.action_callback("web_friends", "", ""); return true; } }; CustomButtonField cbfButton = new CustomButtonField( btnw, strings.getString("read_qr"), buttonoff.getBitmap(), buttonon.getBitmap(), Field.FOCUSABLE | Field.FIELD_HCENTER | Field.FIELD_VCENTER) { protected boolean navigationClick(int status, int time) { c.action_callback("qr_start", "", ""); return true; } }; vfmButton.add(cbfButton); vfmButton.add(bmFieldSpan); vfmButton.add(cbfFriends); fm_MainHolder.add(vfmButton); parent.add(fm_MainHolder); return fm_MainHolder; }
public FirstScreen(final Hashtable hashtable, String[] moduleVisible) { userName = (String) hashtable.get("stringval1"); welcomeTitleDisplay(); add(horizontalWelcomeLabel); pUpdatedBy = (String) hashtable.get("stringval37"); HorizontalFieldManager hfm = new HorizontalFieldManager(FIELD_HCENTER); VerticalFieldManager vfm1 = new VerticalFieldManager(FIELD_HCENTER); VerticalFieldManager vfm2 = new VerticalFieldManager(FIELD_HCENTER); vfm1.setMargin(30, 50, 10, 30); vfm2.setMargin(30, 30, 10, 50); btnCar = new BitmapButtonField(carUnclick, carClick, FIELD_HCENTER) { protected boolean navigationClick(int status, int time) { Controller.showScreen(new StartupScreen(hashtable, 0)); return true; } }; // btnCar.setMargin(30, 0, 0, 30); LabelField l2 = new LabelField("iMotor", FIELD_HCENTER); // l2.setMargin(10, 0, 0, 0); l2.setFont(Constants.fontBold6); btnAeroplane = new BitmapButtonField(travelUnclick, travelClick, FIELD_HCENTER) { protected boolean navigationClick(int status, int time) { Controller.showScreen(new StartupScreen(hashtable, 1)); return true; } }; // btnAeroplane.setMargin(30, 0, 0, 30); LabelField l3 = new LabelField("iTravel", FIELD_HCENTER); // l3.setMargin(10, 0, 0, 0); l3.setFont(Constants.fontBold6); vfm1.add(btnCar); vfm1.add(l2); vfm2.add(btnAeroplane); vfm2.add(l3); for (int i = 0; i < moduleVisible.length; i++) { if (moduleVisible[i].equals("11")) { Constants.iMotorModuleVisible = true; } else if (moduleVisible[i].equals("12")) { Constants.iTravelModuleVisible = true; } } if (Constants.iMotorModuleVisible == true) { hfm.add(vfm1); } if (Constants.iTravelModuleVisible) { hfm.add(vfm2); } add(hfm); }
private void layoutScreen() { Button loginButton; if (settings.isUserLoggedIn()) { loginButton = new Button("Log Out"); loginButton.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { onLogOutButtonClicked(); } }); } else { loginButton = new Button("Log In"); loginButton.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { onLoginButtonClicked(); } }); } Button newChildButton = new Button("Register Child"); newChildButton.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { onNewChildClicked(); } }); Button viewChildrenButton = new Button("View All Children"); viewChildrenButton.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { onViewChildrenClicked(); } }); searchButton = new Button("Search for a Child"); searchButton.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { onSearchClicked(); } }); Button synchronizeButton = new Button("Synchronize"); synchronizeButton.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { onSynchronizeClicked(); } }); Vector buttonGroup = new Vector(); buttonGroup.addElement(loginButton); buttonGroup.addElement(newChildButton); buttonGroup.addElement(viewChildrenButton); buttonGroup.addElement(searchButton); buttonGroup.addElement(synchronizeButton); Button.setOptimimWidthForButtonGroup(buttonGroup); VerticalFieldManager manager = new VerticalFieldManager(FIELD_HCENTER); manager.setPadding(PADDING); loginButton.setPadding(PADDING); manager.add(loginButton); newChildButton.setPadding(PADDING); manager.add(newChildButton); viewChildrenButton.setPadding(PADDING); manager.add(viewChildrenButton); searchButton.setPadding(PADDING); manager.add(searchButton); synchronizeButton.setPadding(PADDING); manager.add(synchronizeButton); add(manager); }
public PickScreen(int voteType) { super(); this.voteType = voteType; VerticalFieldManager vertFieldManager = new VerticalFieldManager( VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.VERTICAL_SCROLLBAR) { // Override the paint method to draw the background image. public void paint(Graphics graphics) { graphics.setColor(Color.BLACK); graphics.fillRect(0, 0, this.getWidth(), this.getHeight()); super.paint(graphics); } }; ; try { // set up the smaller list font ff1 = FontFamily.forName("Verdana"); font2 = ff1.getFont(Font.BOLD, 20); } catch (final ClassNotFoundException cnfe) { } Vector contList = GameData.getCurrentGame().getActiveContestants(); Contestant[] contArray = new Contestant[contList.size()]; contList.copyInto(contArray); ocfActiveContestant = new ObjectChoiceField(" Cast your " + voteType + " vote: ", contArray); User user = GameData.getCurrentGame().getCurrentUser(); if (voteType == T_WEEKLY && user.getWeeklyPick() != null) { ocfActiveContestant.setSelectedIndex(user.getWeeklyPick()); } else if (voteType == T_ULTIMATE && user.getUltimatePick() != null) { ocfActiveContestant.setSelectedIndex(user.getUltimatePick()); } list = new RichList(vertFieldManager, true, 3, 0); // get all contestants for list contList = GameData.getCurrentGame().getAllContestants(); for (int i = 0; i < contList.size(); i++) { Contestant cont = (Contestant) contList.elementAt(i); /* list contains labels so that the text colour can change */ lblContName = new LabelField(cont.getFirstName() + " " + cont.getLastName(), LabelField.ELLIPSIS) { public void paint(Graphics g) { g.setColor(Color.WHITE); super.paint(g); } }; lblContName.setFont(font2); labelContTribe = new LabelField(cont.getTribe(), LabelField.ELLIPSIS) { public void paint(Graphics g) { g.setColor(Color.WHITE); super.paint(g); } }; lblContName.setFont(font2); String tempString = ""; if (cont.isCastOff()) tempString = "Castoff"; else tempString = "Active"; labelTempStatus = new LabelField(tempString, LabelField.ELLIPSIS) { public void paint(Graphics g) { g.setColor(Color.WHITE); super.paint(g); } }; lblContName.setFont(font2); Bitmap imgContestant = getImage(cont.getPicture()); list.add(new Object[] {imgContestant, lblContName, labelContTribe, labelTempStatus}); } HorizontalFieldManager horFieldManager = new HorizontalFieldManager( HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.FIELD_HCENTER) { // Override the paint method to draw the background image. public void paint(Graphics graphics) { graphics.setColor(Color.GREEN); graphics.fillRect(0, 0, this.getWidth(), this.getHeight()); super.paint(graphics); } }; ; String voted = "Vote"; user = GameData.getCurrentGame().getCurrentUser(); System.out.println(user.getWeeklyPick() + " " + this.voteType); if ((this.voteType == T_WEEKLY && user.getWeeklyPick() != null) || (this.voteType == T_ULTIMATE && user.getUltimatePick() != null)) voted = "Revote"; btnVoted = new ButtonField(voted); btnVoted.setChangeListener(this); horFieldManager.add(btnVoted); horFieldManager.add(ocfActiveContestant); horFieldManager.setFont(font2); this.setTitle(horFieldManager); this.add(vertFieldManager); this.setStatus(Common.getToolbar("Log Out")); vertFieldManager.setFocus(); // THIS NEEDS TO BE HERE. APP CRASHES WITHOUT IT }
public TaskScreen(Task task) { super(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR); internalManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR); super.add(internalManager); internalManager.add(new TitleField(TaskUtils.getPath(task))); manager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); internalManager.add(manager); this.task = task; Font bold = getFont().derive(Font.BOLD); HeaderLabel name = new HeaderLabel(task.getName()); name.setFont(bold); RichTextField description = new RichTextField(task.getDescription()) { public void paint(Graphics graphics) { graphics.setColor(0x00777777); super.paint(graphics); } }; add(name); if (task.getPriority() != Task.NORMAL_PRIORITY) { BitmapInput priority = new BitmapInput( "Priority", task.getPriority() == Task.LOW_PRIORITY ? "low_priority.png" : "high_priority"); priority.setEditable(false); priority.setSelected(task.getPriority()); add(priority); } String statusRes = ""; switch (task.getStatus()) { case Task.NOT_STARTED: statusRes = ("not_started.png"); break; case Task.IN_PROGRESS: statusRes = ("progress.png"); break; case Task.WAITING: statusRes = ("waiting.png"); break; case Task.DEFERRED: statusRes = ("deferred.png"); break; case Task.COMPLETED: statusRes = ("completed.png"); break; } status = new BitmapInput("Status", statusRes); status.setEditable(false); status.setSelected(task.getStatus()); add(status); percent_complete = new BitmapInput( "Percent Complete", task.getPercentComplete() + "% Complete", "percent_complete.png"); percent_complete.setEditable(false); add(percent_complete); BitmapInput tags = new BitmapInput("Tags", "tags.png"); tags.setTextQuiet(TaskUtils.getTags(task)); tags.setEditable(false); add(tags); if (task.getDescription().length() > 0) add(description); Font header = getFont().derive(Font.BOLD, getFont().getHeight() - 4); HeaderLabel l_dr = new HeaderLabel("Due Date"); l_dr.setFont(header); BitmapInput dueDate = new BitmapInput("Due Date", "soon.png"); if (task.getDateDue() > 0) { dueDate.setTextQuiet( "Due date: " + new SimpleDateFormat(DateFormat.DATETIME_DEFAULT).formatLocal(task.getDateDue())); System.out.println("REMINDER: " + task.getDateDue()); } else dueDate.setTextQuiet("No due date set."); dueDate.setEditable(false); BitmapInput reminder = new BitmapInput("Reminder", "reminder.png"); if (task.getReminder() > 0) { reminder.setTextQuiet( "Reminder: " + new SimpleDateFormat(DateFormat.DATETIME_DEFAULT) .formatLocal(task.getDateDue() - (task.getReminder() * 1000))); System.out.println("REMINDER: " + task.getReminder()); } else reminder.setTextQuiet("No reminder set."); reminder.setEditable(false); add(l_dr); add(dueDate); add(reminder); if (task.getDateDue() > 0) { BitmapInput viewInCalendar = new BitmapInput("View in Calendar", "today.png"); viewInCalendar.setTask(task); add(viewInCalendar); } HeaderLabel l_notes = new HeaderLabel("Notes"); l_notes.setFont(header); notes = new NoteManager(task); add(l_notes); add(notes); }
public void add(Field f) { manager.add(f); }
public CambiarPuntosMap() { if (Display.getWidth() == 320) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground( Bitmap.getBitmapResource("background_320.png"))); tFuente = 17; tFuente2 = 20; veinticinco = 10; veinte = 10; trecientoscuarentaysiete = 170; setenta = 35; hr = Bitmap.getBitmapResource("hr_line_3.png"); leftHr = 10; btnMapa = Bitmap.getBitmapResource("btnMapa_320.png"); btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png"); btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png"); btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png"); } if (Display.getWidth() == 360) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground( Bitmap.getBitmapResource("background_360.png"))); tFuente = 20; tFuente2 = 23; veinticinco = 10; veinte = 10; trecientoscuarentaysiete = 403; setenta = 35; hr = Bitmap.getBitmapResource("hr_line_3.png"); leftHr = 30; btnMapa = Bitmap.getBitmapResource("btnMapa_320.png"); btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png"); btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png"); btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png"); } if (Display.getWidth() == 480) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground( Bitmap.getBitmapResource("background_480.png"))); tFuente = 20; tFuente2 = 23; veinticinco = 10; veinte = 10; trecientoscuarentaysiete = 291; setenta = 35; hr = Bitmap.getBitmapResource("hr_line.png"); leftHr = 0; btnMapa = Bitmap.getBitmapResource("btnMapa_320.png"); btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png"); btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png"); btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png"); } if (Display.getWidth() == 640) { getMainManager() .setBackground( BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png"))); tFuente = 35; tFuente2 = 40; } try { FontFamily ffFont1 = FontFamily.forName("Arial"); fLite = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente); fTitle = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente2); // hr = Bitmap.getBitmapResource("hr_line.png"); // getMainManager().setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png"))); VerticalFieldManager logoHfm = new VerticalFieldManager(VerticalFieldManager.FIELD_HCENTER); logoHfm.setBackground( BackgroundFactory.createLinearGradientBackground(0xe68241, 0xe68241, 0xd16f2f, 0xd16f2f)); logoHfm.setMargin(0, 0, 0, 0); ColorRichText emailCrt = new ColorRichText( Strings.CHANGECONFIG, 0xffffff, RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER); emailCrt.setFont(fTitle); emailCrt.setMargin(veinticinco, 0, veinticinco, 0); logoHfm.add(emailCrt); VerticalField footerLogoHfm = new VerticalField(Display.getWidth(), veinte, VerticalFieldManager.FIELD_HCENTER); footerLogoHfm.setBackground( BackgroundFactory.createLinearGradientBackground(0x9cbe4f, 0x7a9b3c, 0x7a9b3c, 0x9cbe4f)); ColorRichText introCrt = new ColorRichText( "Elige tus puntos favoritos", 0xffffff, RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER); introCrt.setFont(fTitle); introCrt.setMargin(25, 0, 25, 0); footerLogoHfm.add(introCrt); logoHfm.add(footerLogoHfm); add(logoHfm); VerticalField allContentFiltro = new VerticalField( Display.getWidth(), trecientoscuarentaysiete, HorizontalField.FIELD_HCENTER | VerticalField.VERTICAL_SCROLL | VerticalField.VERTICAL_SCROLLBAR); Object[] municipioO = new Object[] {"one", "two", "three"}; ObjectChoiceField municipioOcf = new FullWidthChoiceField(); municipioOcf.setChoices(municipioO); municipioOcf.setMargin(0, 70, 0, 70); VerticalFieldManager municipioVfm = new VerticalFieldManager( VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER); LabelField municipioLf = new LabelField("Municipio", LabelField.FIELD_HCENTER); municipioLf.setFont(fLite); municipioLf.setMargin(15, 0, 5, 0); municipioVfm.add(municipioLf); // |/ DrawStyle.HCENTER)); municipioVfm.add(municipioOcf); hrBf = new BitmapField(hr); hrBf.setMargin(20, 0, 0, leftHr); municipioVfm.add(hrBf); allContentFiltro.add(municipioVfm); /**/ Object[] establecimientoO = new Object[] {"one", "two", "three"}; ObjectChoiceField establecimientoOcf = new FullWidthChoiceField(); establecimientoOcf.setChoices(establecimientoO); establecimientoOcf.setMargin(0, 70, 0, 70); VerticalFieldManager establecimientoVfm = new VerticalFieldManager( VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER); LabelField establecimientoLf = new LabelField("Establecimiento", LabelField.FIELD_HCENTER); establecimientoLf.setFont(fLite); establecimientoLf.setMargin(15, 0, 5, 0); establecimientoVfm.add(establecimientoLf); // |/ DrawStyle.HCENTER)); establecimientoVfm.add(establecimientoOcf); hrBf = new BitmapField(hr); hrBf.setMargin(20, 0, 0, leftHr); establecimientoVfm.add(hrBf); allContentFiltro.add(establecimientoVfm); HorizontalFieldManager botonesHfc = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER); // botonesHfc.setMargin(0, 50, 0, 0); BitmapButtonField btnMapaUser = new BitmapButtonField(btnMapa, btnMapa1, Field.FIELD_HCENTER); btnMapaUser.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap()); } }); btnMapaUser.setMargin(20, 10, 0, 0); BitmapButtonField btnAgregarMapaUser = new BitmapButtonField(btnAgregarMapa, btnAgregarMapa1, Field.FIELD_HCENTER); btnAgregarMapaUser.setChangeListener( new FieldChangeListener() { public void fieldChanged(Field field, int context) { UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap()); } }); btnAgregarMapaUser.setMargin(20, 10, 0, 0); botonesHfc.add(btnMapaUser); botonesHfc.add(btnAgregarMapaUser); allContentFiltro.add(botonesHfc); add(allContentFiltro); } catch (Exception e) { // TODO: handle exception System.out.println(e.getMessage()); add(new RichTextField(e.getMessage())); } }
private void askWhat() { int apa = Dialog.ask( "What to do?", new String[] {"Draw to image", "Add Filter", "Transparent", "Remove"}, 0); if (apa == 0) { this.g.setGlobalAlpha(gbrfield.getTransparent()); if (gbrfield.getText() != null) { this.g.setFont(gbrfield.getFont()); int c = g.getColor(); this.g.setFont(gbrfield.getFont()); this.g.setColor(gbrfield.getColor()); this.g.drawText(gbrfield.getText(), gbrfield.getX(), gbrfield.getY()); this.g.setColor(c); gbrfield.setText(null); gbrfield.setGbr(null); } else if (gbrfield.getGbr() != null) { this.g.drawBitmap( gbrfield.getX(), gbrfield.getY(), gbrfield.getGbr().getWidth(), gbrfield.getGbr().getHeight(), gbrfield.getGbr(), 0, 0); gbrfield.setText(null); gbrfield.setGbr(null); } gbrfield.setTransparent(255); latar.invalidate(); Mulai.playTune(); } else if (apa == 1) { if (gbrfield.getGbr() != null) { int ask = Dialog.ask( "What Filter?", new String[] {"GrayScale", "Negative", "Sephia", "Thermal"}, 0); FilterImg.doit(gbrfield.getGbr(), ask); gbrfield.setGbr(gbrfield.getGbr()); } } else if (apa == 2) { int ask = Dialog.ask("Transparent Value?", new String[] {"255", "200", "150", "100", "50"}, 0); switch (ask) { case 0: gbrfield.setTransparent(255); break; case 1: gbrfield.setTransparent(200); break; case 2: gbrfield.setTransparent(150); break; case 3: gbrfield.setTransparent(100); break; case 4: gbrfield.setTransparent(50); break; default: break; } } else if (apa == 3) { gbrfield.setText(null); gbrfield.setGbr(null); gbrfield.setTransparent(255); } }
public MenuOpciones() { VerticalFieldManager vField = new VerticalFieldManager(); UsuarioDB usuarios = new UsuarioDB(); usuario = usuarios.getUsuario(); usuarios = null; // meGlobales.setPerfil(perfil); HorizontalFieldManager hField = new HorizontalFieldManager() { protected void sublayout(int width, int height) { super.sublayout(super.getScreen().getWidth(), height); super.setExtent(super.getScreen().getWidth(), getField(1).getHeight()); Field field; field = getField(0); layoutChild(field, width / 2, height); // setPositionChild(field, (width / 4) - ( field.getPreferredWidth() / 2), 0); setPositionChild(field, 5, 0); field = getField(1); layoutChild(field, width, height); setPositionChild(field, (width / 2) + (width / 4) - (field.getPreferredWidth() / 2), 0); } }; vField.add(new LabelField("", LabelField.FIELD_LEFT)); vField.add( new mkpyLabelField( usuario.getNombre(), LabelField.ELLIPSIS | LabelField.FIELD_LEFT, Color.BLACK, Color.WHITE, true)); vField.add(new LabelField(usuario.getZonaRegionPais(), LabelField.FIELD_LEFT)); vField.add(new LabelField(usuario.getCampanaFormato(), LabelField.FIELD_LEFT)); hField.add(vField); hField.add( new BitmapField( Bitmap.getBitmapResource("img/logo.png"), BitmapField.FIELD_LEFT | BitmapField.FIELD_VCENTER)); opciones = MetodosGlobales.menuOpcionesxPerfil(); menu = new ListField(opciones.length, ListField.FIELD_HCENTER); menu.setCallback(this); add( new BitmapField( Bitmap.getBitmapResource("img/titulos/menuprincipal.png"), BitmapField.FIELD_HCENTER)); add(hField); add(menu); addMenuItem(mnSincronizar); addMenuItem(mnAcerca); addMenuItem(mnCerrarSesion); Sistema.addEstadistica(Cadenas.MENUPRINCIPAL); if (usuario != null) { // MBL : Timer de sincronización long tiempo = usuario.getTiempoDatosConsultora() * 60 * 60000; // mbl: En horas // long tiempo = 3*60*1000; timer = new Timer(); timer.schedule(new Sicronizacion(), tiempo, tiempo); } }
public void addLog(LogEntryField field) { logEntries.addElement(field); if (Level.isGreaterOrEqual(field.getLogLevel(), displayLevel)) { vfm.add(field); } }
public void reloadFav(RoomChat tf) { TombolRoomField tfs = new TombolRoomField(tf, "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setFavourite(true); Favourite.add(tfs); }