Esempio n. 1
0
 protected boolean navigationClick(int status, int time) {
   if (gbrfield.getText() != null || gbrfield.getGbr() != null) {
     askWhat();
     return true;
   }
   return super.navigationClick(status, time);
 };
Esempio n. 2
0
 protected boolean keyChar(char c, int status, int time) {
   if (c == Characters.ESCAPE) {
     if (gbrfield.getText() != null || gbrfield.getGbr() != null) {
       askWhat();
       return true;
     }
   }
   return super.keyChar(c, status, time);
 }
Esempio n. 3
0
 public void run() {
   inputBox apa = new inputBox("Your Text?", "");
   String txt = apa.getNama();
   if (txt.length() > 0) {
     gbrfield.setText(txt);
     gbrfield.setColor(apa.getColor());
     gbrfield.setFont(apa.getFont());
     apa = null;
   }
 }
Esempio n. 4
0
  protected boolean keyDown(int in_nKeyCode, int in_nTime) {
    int nKeyPressed = Keypad.key(in_nKeyCode);

    if (nKeyPressed == Keypad.KEY_MENU) {
      if (gbrfield.getText() != null || gbrfield.getGbr() != null) {
        askWhat();
        return true;
      }
    }

    return super.keyDown(in_nKeyCode, in_nTime);
  }
Esempio n. 5
0
 public void run() {
   int apa = Dialog.ask("Direction?", new String[] {"left", "up", "right", "down"}, 0);
   Bitmap bmp = null;
   if (apa == 0) {
     bmp = rotateImage(Bitmap.getBitmapResource("right.png"), 180);
   } else if (apa == 1) {
     bmp = Bitmap.getBitmapResource("up.png");
   } else if (apa == 2) {
     bmp = Bitmap.getBitmapResource("right.png");
   } else if (apa == 3) {
     bmp = rotateImage(Bitmap.getBitmapResource("up.png"), 180);
   }
   gbrfield.setGbr(bmp);
 }
Esempio n. 6
0
  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);
  }
Esempio n. 7
0
 public void run() {
   FileSelectorPopupScreen fs =
       new FileSelectorPopupScreen(
           System.getProperty("fileconn.dir.memorycard.photos").substring(8),
           new String[] {"png", "jpg", "gif", "jpeg"});
   fs.pickFile();
   if (Util.cekDir("file:///" + fs.getFile(), false)) {
     int apa =
         Dialog.ask(
             "Resize if bigger than Screen",
             new String[] {"100%", "80%", "50%", "30%", "10%"},
             0);
     String data = Util.bacaFile("file:///" + fs.getFile());
     EncodedImage img =
         EncodedImage.createEncodedImage(data.getBytes(), 0, data.getBytes().length);
     int sw = 0, sh = 0;
     if (apa == 0) {
       sw = Display.getWidth();
       sh = Display.getHeight();
     } else if (apa == 1) {
       sw = (int) (0.8 * Display.getWidth());
       sh = (int) (0.8 * Display.getHeight());
     } else if (apa == 2) {
       sw = (int) (0.5 * Display.getWidth());
       sh = (int) (0.5 * Display.getHeight());
     } else if (apa == 3) {
       sw = (int) (0.3 * Display.getWidth());
       sh = (int) (0.3 * Display.getHeight());
     } else if (apa == 4) {
       sw = (int) (0.1 * Display.getWidth());
       sh = (int) (0.1 * Display.getHeight());
     } else {
       return;
     }
     gbrfield.setGbr(ImageUtil.bestFit2(img, sw, sh).getBitmap());
     img = null;
   }
 }
Esempio n. 8
0
  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);
    }
  }
Esempio n. 9
0
 public void run() {
   gbrfield.setGbr(Bitmap.getBitmapResource("helpme.png"));
 }