public UserInput() { super(USE_ALL_WIDTH); userField = new CustomEditField( FIELD_LEFT | BasicEditField.NO_NEWLINE | BasicEditField.NO_SWITCHING_INPUT); fontSetting.setPoint(Font.PLAIN, 7); userField.setFont(fontSetting.getFont()); userField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); add(userField); Bitmap icon = Bitmap.getBitmapResource("icon_user.png"); if (Variables.smallScreen()) { int newWidth = icon.getWidth() * 320 / 480; int newHeight = icon.getHeight() * 240 / 360; icon = ImageUtils.resizeBitmap(icon, newWidth, newHeight); } userImage = new BitmapField(icon); userImage.setBackground(BackgroundFactory.createSolidBackground(0xf7f7f7)); userImage.setBorder( BorderFactory.createSimpleBorder( new XYEdges(1, 1, 1, 1), new XYEdges(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY), Border.STYLE_SOLID)); add(userImage); }
public PassLockInput() { super(USE_ALL_WIDTH); passField = new CustomPasswordField("", "Password", 30, FIELD_LEFT | PasswordEditField.NO_NEWLINE); fontSetting.setPoint(Font.PLAIN, 7); passField.setFont(fontSetting.getFont()); passField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); add(passField); Bitmap icon = Bitmap.getBitmapResource("icon_lock.png"); if (Variables.smallScreen()) { int newWidth = icon.getWidth() * 320 / 480; int newHeight = icon.getHeight() * 240 / 360; icon = ImageUtils.resizeBitmap(icon, newWidth, newHeight); } passImage = new BitmapField(icon); passImage.setBackground(BackgroundFactory.createSolidBackground(0xf7f7f7)); passImage.setBorder( BorderFactory.createSimpleBorder( new XYEdges(1, 1, 1, 1), new XYEdges(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY), Border.STYLE_SOLID)); add(passImage); }
protected void paint(Graphics g) { g.setColor(Color.WHITE); g.fillRect(0, 0, userField.getWidth() + 8, userImage.getHeight()); g.setColor(Color.GRAY); g.drawRect(0, 0, userField.getWidth() + 8, userImage.getHeight()); super.paint(g); }
protected void sublayout(int width, int height) { layoutChild(userImage, width, height); layoutChild(userField, width - (userImage.getWidth() + 7), height); setPositionChild(userField, 6, (userImage.getHeight() - userField.getHeight()) / 2); setPositionChild(userImage, width - userImage.getWidth(), 0); setExtent(width, userImage.getHeight()); }
public ImageDisplayScreen(EncodedImage image) { int displayWidth = Fixed32.toFP(Display.getWidth()); int imageWidth = Fixed32.toFP(image.getWidth()); int scalingFactor = Fixed32.div(imageWidth, displayWidth); EncodedImage scaledImage = image.scaleImage32(scalingFactor, scalingFactor); BitmapField bitmapFiled = new BitmapField(); bitmapFiled.setImage(scaledImage); add(bitmapFiled); }
private void addLogo() { Bitmap bitmap = Bitmap.getBitmapResource("res/logo.jpg"); if (bitmap == null) { return; } BitmapField field = new BitmapField(bitmap, FIELD_HCENTER); field.setPadding(PADDING); add(field); }
protected void paint(Graphics graphics) { super.paint(graphics); if (currentFrame != 0) { graphics.drawImage( image.getFrameLeft(currentFrame), image.getFrameTop(currentFrame), image.getFrameWidth(currentFrame), image.getFrameHeight(currentFrame), image, currentFrame, 0, 0); } }
protected void paint(Graphics graphics) { // Call super.paint. This will draw the first background // frame and handle any required focus drawing. super.paint(graphics); // Don't redraw the background if this is the first frame. if (_currentFrame != 0) { // Draw the animation frame. graphics.drawImage( _image.getFrameLeft(_currentFrame), _image.getFrameTop(_currentFrame), _image.getFrameWidth(_currentFrame), _image.getFrameHeight(_currentFrame), _image, _currentFrame, 0, 0); } }
protected void onDisplay() { animatorThread = new AnimatorThread(this); animatorThread.start(); super.onDisplay(); }
protected void onUndisplay() { animatorThread.stop(); super.onUndisplay(); }
protected synchronized void onDisplay() { _animatorThread.startAnimation(); super.onUndisplay(); }
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())); } }
public void ErrorImage(BitmapField bf, String error) { synchronized (UiApplication.getEventLock()) { bf.setBitmap(Bitmap.getBitmapResource("img/errorload.png")); } }
public void DownloadedImage(EncodedImage ei, BitmapField fImg, int wsize) { ei = getScaledImage(ei, wsize); synchronized (UiApplication.getEventLock()) { fImg.setBitmap(ei.getBitmap()); } }
public void DownloadedImage(EncodedImage ei, BitmapField fImg) { synchronized (UiApplication.getEventLock()) { fImg.setBitmap(ei.getBitmap()); } }