public void taskEdited(Task task) {
    task.updateEvent();
    com.zavitz.mytasks.functions.PersistentUtils.save();

    UiApplication.getUiApplication().popScreen(this);
    UiApplication.getUiApplication().pushScreen(new TaskScreen(task));
  }
Beispiel #2
0
  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");
    }
  }
Beispiel #3
0
 public void fieldChanged(Field f, int i) {
   if (f == exit) {
     screen = null;
     UiApplication.getUiApplication().popScreen(this);
   } else if (f instanceof ListItemField) {
     int category = ((ListItemField) (f)).getId();
     if (category > -1) {
       screen = new GamePlayScreen(false, category, 1, false, -1, 0, -1);
       UiApplication.getUiApplication().pushScreen(screen);
     }
   }
 }
 public void fieldChanged(Field field, int context) {
   ButtonField btn4 = (ButtonField) field;
   if (btn4.getLabel().toString() == "Next") {
     cs6.storeUIFieldsToCitation();
     if (cs6.field_alcohol.getChecked() == true) {
       UiApplication.getUiApplication().pushScreen(new CitationScreen7(c));
     } else {
       UiApplication.getUiApplication().pushScreen(new CitationScreen8(c));
     }
   } else if (btn4.getLabel().toString() == "Prev") {
     cs6.storeUIFieldsToCitation();
     UiApplication.getUiApplication().popScreen(cs6);
   }
 }
 public boolean keyChar(char c, int status, int time) {
   handleSearchType();
   switch (c) {
     case Characters.ENTER:
       return true;
     case Characters.ESCAPE:
       UiApplication.getUiApplication()
           .popScreen(UiApplication.getUiApplication().getActiveScreen());
       return true;
     default:
       boolean retValue = super.keyChar(c, status, time);
       handleSearchType();
       return retValue;
   }
 }
  /** @see java.lang.Runnable#run() */
  public void run() {
    // Perform random actions to the message store every three seconds
    MessageListDemoStore messageStore = MessageListDemoStore.getInstance();
    while (_keepRunning) {
      try {
        synchronized (messageStore) {
          performAction(messageStore);
        }
      } catch (Exception e) {

      }
      try {
        synchronized (this) {
          wait(300000);
        }
      } catch (final InterruptedException e) {
        UiApplication.getUiApplication()
            .invokeLater(
                new Runnable() {
                  public void run() {
                    Dialog.alert("Thread#wait(long) threw " + e.toString());
                  }
                });

        return;
      }
    }
  }
 /**
  * Method for handling Field change events
  *
  * @param Field The field that changed
  * @param Information specifying the origin of the change
  */
 public void fieldChanged(Field field, int context) {
   if (field == goBack) {
     UiApplication.getUiApplication().pushScreen(new Game(currentUser));
   } else if (field == questionsList) {
     displayAnswer();
   }
 }
Beispiel #8
0
 public void fieldChanged(Field f, int i) {
   if (f == yes) {
     doConnect(Const.savecard + card.getId());
   } else if (f == no) {
     UiApplication.getUiApplication().popScreen(this);
   }
 }
Beispiel #9
0
  public void AsyncDownloadImage(String url, final BitmapField fImg, final int resizew) {
    url += ";deviceside=true";
    final String furl = url;
    EncodedImage ei;

    UiApplication.getUiApplication()
        .invokeLater(
            new Runnable() {
              public void run() {
                InputStream inputStream = null;
                try {
                  ConnectionFactory cf = new ConnectionFactory();
                  cf.setConnectionTimeout(8333);
                  ConnectionDescriptor cd = cf.getConnection(furl);
                  HttpConnection httpConn;
                  httpConn = (HttpConnection) cd.getConnection();
                  inputStream = httpConn.openInputStream();
                  StringBuffer rawResponse = new StringBuffer();
                  byte[] responseData = new byte[10000];
                  int length = 0;
                  while (-1 != (length = inputStream.read(responseData))) {
                    rawResponse.append(new String(responseData, 0, length));
                  }
                  String result = rawResponse.toString();
                  byte[] dataArray = result.getBytes();
                  EncodedImage ei = EncodedImage.createEncodedImage(dataArray, 0, dataArray.length);
                  httpConn.close();
                  DownloadedImage(ei, fImg, resizew);
                } catch (Exception e1) {
                  ErrorImage(fImg, e1.toString());
                }
              }
            });
  }
 public void clickButton() {
   try {
     UiApplication.getUiApplication()
         .pushScreen(new NewsDetailScreen((NewsScreen) this.getScreen(), newsItem, newsImage));
   } catch (Exception ex) {
   }
 }
    public void run() {
      try {

        // serviceClient.setParameter("yozehariando");
        final TwitterApi[] twitterApis = serviceClient.getTwitterApi().getResult();

        UiApplication.getUiApplication()
            .invokeLater(
                new Runnable() {

                  public void run() {
                    while (twitterListField.getSize() > 0) {
                      twitterListField.delete(0);
                    }

                    if (twitterApis.length > 0) {
                      twitterListField.clear();

                      for (int i = 0; i < twitterApis.length; i++) {
                        log.debug("Screen : " + twitterApis[i].getText());
                        twitterListField.insert(twitterListField.getSize());
                        twitterListField.add(twitterApis[i]);
                      }
                      twitterListField.loadBitmap();
                    }
                  }
                });
      } catch (Exception e) {
        log.error(e.getMessage());
        fireaction(ERROR_ENTER, e.getMessage());
      }
    }
    public void run() {
      while (keepGoing) {
        UiApplication.getUiApplication()
            .invokeAndWait(
                new Runnable() {

                  public void run() {
                    theField.invalidate();
                  }
                });

        try {
          long l = image.getFrameDelay(currentFrame) * 10;
          sleep(l);
        } catch (InterruptedException iex) {
        }

        ++currentFrame;

        if (currentFrame == totalFrames) {
          currentFrame = 0;

          ++loopCount;

          if (loopCount == totalLoops) {
            keepGoing = false;
          }
        }
      }
    }
  public void run() {
    try {
      player = Manager.createPlayer("capture://audio?encoding=audio/basic");
      player.realize();

      rCtl = (RecordControl) player.getControl("RecordControl");

      Control[] c = player.getControls();
      for (int i = c.length - 1; i >= 0; i--) {
        if (c[i] instanceof AudioPathControl) {
          apc = (AudioPathControl) c[i];

          oldPath = apc.getAudioPath();
          apc.setAudioPath(AudioPathControl.AUDIO_PATH_HANDSFREE);
          path = apc.getAudioPath();

          break;
        }
      }

      rCtl.setRecordStream(strm);
      rCtl.startRecord();

      player.start();
    } catch (Exception e) {
      final String msg = e.toString();
      UiApplication.getUiApplication()
          .invokeAndWait(
              new Runnable() {
                public void run() {
                  Dialog.inform(msg);
                }
              });
    }
  }
    public void run() {
      while (_keepGoing) {
        // Invalidate the field so that it is redrawn.
        UiApplication.getUiApplication()
            .invokeAndWait(
                new Runnable() {
                  public void run() {
                    _theField.invalidate();
                  }
                });

        try {
          // Sleep for the current frame delay before the next frame is drawn.
          sleep(_image.getFrameDelay(_currentFrame) * 10);
        } catch (InterruptedException iex) {
        } // Couldn't sleep.

        // Increment the frame.
        ++_currentFrame;

        if (_currentFrame == _totalFrames) {
          // Reset back to frame 0 if we have reached the end.
          _currentFrame = 0;

          ++_loopCount;

          // Check if the animation should continue.
          if (_loopCount == _totalLoops) {
            _keepGoing = false;
          }
        }
      }
    }
Beispiel #15
0
 public Layout(CMainScreen c) {
   super(c);
   UiApplication ui = UiApplication.getUiApplication();
   theApp = (UiApplication) ui;
   strings = new Strings();
   setUpAssets();
 }
  private void convertHashTableToArray(Hashtable hashtable) {

    String icCodesString = (String) hashtable.get("stringval1");
    String productsString = (String) hashtable.get("stringval2");

    String[] icCodesArray = null;
    if (productsString != null) {

      if (icCodesString != null) {
        icCodesArray = StringSplitter.INSTANCE.split(icCodesString, "~");
      }

      String[] productsArray = StringSplitter.INSTANCE.split(productsString, "~");

      if (productsArray != null) {
        Constant.oldProductArray = productsArray;
      }
      if (icCodesArray != null) {
        Constant.oldICCodeArray = icCodesArray;
      }

    } else {
      UiApplication.getUiApplication()
          .invokeLater(
              new Runnable() {

                public void run() {
                  Dialog.alert(
                      "Failed to Refresh Product List for Visit info, Prerequisite configuration not available on server..");
                }
              });
    }
  }
 /*
  * Stop Scheduler Update when Escape this Screen
  */
 protected boolean keyChar(char c, int status, int time) {
   if (c == Characters.ESCAPE) {
     streamTimer.cancel();
     UiApplication.getUiApplication().popScreen(this);
     return true;
   }
   return false;
 }
  /**
   * This method displays the correct answer field, either a short answer text box or multiple
   * answers, depending on the question type
   */
  private void displayAnswer() {

    int type = 0; // question type
    type_list = CreateQTypeList(); // retrieve types
    String question = (String) questionsList.getChoice(questionsList.getSelectedIndex());

    for (int i = 0; i < questions_list.length; i++) {
      if (questionsList.getSelectedIndex() == i) // questionList is the drop-down list
      type = type_list[i];
    }

    if (type == 0 && !(question.equals("None"))) // if  type is 0, display a panel with a text box
    {
      // displayAnswer constructor format: public DisplayAnswer(int type, String[] multAnswersArray,
      // String question,String currentUser, double QID, int week)
      UiApplication.getUiApplication()
          .pushScreen(
              new DisplayAnswer(
                  0,
                  null,
                  (String) questionsList.getChoice(questionsList.getSelectedIndex()),
                  currentUser,
                  question_object_array[questionsList.getSelectedIndex() - 1].getQID(),
                  week));

    } else if (type == 1
        && !(question.equals(
            "None"))) // if type is 1, display a panel with radio buttons for multiple answers
    {
      String multAnswers[] =
          question_object_array[questionsList.getSelectedIndex() - 1]
              .getMultAnswers(); // retrieve the multiple answers.
      // its length minus one because of the none string
      // displayAnswer constructor format: public DisplayAnswer(int type, String[] multAnswersArray,
      // String question,String currentUser, double QID, int week)
      UiApplication.getUiApplication()
          .pushScreen(
              new DisplayAnswer(
                  1,
                  multAnswers,
                  (String) questionsList.getChoice(questionsList.getSelectedIndex()),
                  currentUser,
                  question_object_array[questionsList.getSelectedIndex() - 1].getQID(),
                  week));
    }
  }
  /** Registers file system listener and launches native voice notes recorder application. */
  protected void setup() {
    // register listener for files being written
    synchronized (UiApplication.getEventLock()) {
      UiApplication.getUiApplication().addFileSystemJournalListener(listener);
    }

    // launch the native voice notes recorder application
    AudioControl.launchAudioRecorder();
  }
  /** Unregisters file system listener and closes native voice notes recorder application. */
  protected void teardown() {
    // remove file system listener
    synchronized (UiApplication.getEventLock()) {
      UiApplication.getUiApplication().removeFileSystemJournalListener(listener);
    }

    // close the native voice notes recorder application
    AudioControl.closeAudioRecorder();
  }
Beispiel #21
0
 public void run() {
   int index = _listaConsulResumen.getSelectedIndex();
   Item item = (Item) get(_listaConsulResumen, index);
   if (!item.isCabecera()) {
     item = (Item) jerarquia.elementAt(item.getIndexPadre());
   }
   UiApplication.getUiApplication()
       .pushScreen(new FacturacionDetalle(item.getDescripcion()));
 }
Beispiel #22
0
 public void hideWaitingScreen() {
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               waiting_dialog.close();
             }
           });
 }
Beispiel #23
0
 public void showWaitingScreen() {
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               waiting_dialog.doModal();
             }
           });
 }
 public void onConnectionProblem() {
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               setProgressMsg("Connection Problem");
               setLoginButton();
             }
           });
 }
Beispiel #25
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);
  }
Beispiel #26
0
 public void refresh() {
   invalidate();
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               updateDisplay();
             }
           });
 }
Beispiel #27
0
 public void openBrowser(final String url) {
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               BrowserSession browserSession = Browser.getDefaultSession();
               browserSession.displayPage(url); // or your intranet site
             }
           });
 }
Beispiel #28
0
  private static Bitmap getDefaultHeadImage() throws Exception {

    if (sm_defaultHeadImage == null) {

      if (sm_mainApp == null && UiApplication.getUiApplication() instanceof recvMain) {
        sm_mainApp = (recvMain) UiApplication.getUiApplication();
      }

      byte[] bytes =
          IOUtilities.streamToBytes(
              sm_mainApp
                  .getClass()
                  .getResourceAsStream(
                      fsm_largeHeadImage ? "/defaultHeadImage_l.png" : "/defaultHeadImage.png"));
      sm_defaultHeadImage = EncodedImage.createEncodedImage(bytes, 0, bytes.length).getBitmap();
      sm_defaultHeadImageHashCode = bytes.length;
    }

    return sm_defaultHeadImage;
  }
 public void fail() {
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               errorLoadingImage = true;
               isLoadingImage = false;
               invalidate();
             }
           });
 }
 public void setBitmap(final Bitmap b) {
   UiApplication.getUiApplication()
       .invokeLater(
           new Runnable() {
             public void run() {
               imageBmp = b;
               isLoadingImage = false;
               invalidate();
             }
           });
 }