Example #1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   super.givePlayer(player1);
   super.givePlayer(player2);
   super.givePlayer(player3);
   super.givePlayer(player4);
   setContentView(R.layout.gameshow_buzzer);
 }
Example #2
0
  public void setCameraPreviewSize(Camera.Parameters cp) {
    List<CameraController.Size> cs = CameraController.getInstance().getSupportedPreviewSizes();

    CameraController.Size os =
        getOptimalPreviewSize(cs, MainScreen.getImageWidth(), MainScreen.getImageHeight());
    cp.setPreviewSize(os.getWidth(), os.getHeight());
    try {
      CameraController.getInstance().setCameraParameters(cp);
    } catch (RuntimeException e) {
      Log.e("CameraTest", "MainScreen.setupCamera unable setParameters " + e.getMessage());
    }
  }
Example #3
0
 /**
  * Initializes the controller class. This method is automatically called after the fxml file has
  * been loaded.
  *
  * @param location
  * @param resources
  */
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   MainScreen.addObserver(this);
   chosenPlugin = new File[2];
   defaultimage = new Image("/utilities/cone.png");
   appData = new ArrayList();
   plugins = new ArrayList();
   labels = new ArrayList();
   icons = new ArrayList();
   preview = new ArrayList();
   iconsView = new ArrayList();
   if (change == null || !change) {
     newAppData = appData;
     change = false;
   }
   addPlugins();
   setEvents();
   changeGreeting(greeting);
   /** Sets the settings button to be visible on key pressed */
   anchorPane.setOnKeyPressed(
       ke -> {
         if (ke.getCode().equals(KeyCode.K)) {
           settingbtn.setVisible(true);
         }
       });
 }
  /**
   * This mSerod is executed when the user hit's the enter button. It will delete the link on
   * selected interface.
   *
   * @author Key
   */
  private void okButton() {
    try {
      String CR = txtCR.getText();
      if (CR.matches("[0-9]+")) {
        if (Sim.getNode(NodeName) instanceof NetworkLayerDevice) {
          NetworkLayerDevice tmpNode = (NetworkLayerDevice) Sim.getNode(NodeName);
          tmpNode.getConfig().executeCommand("int " + NodeInt + " clock-rate " + CR);

          if (chkUP.isSelected()) {
            tmpNode.getConfig().executeCommand("int " + NodeInt + " shutdown");
            tmpNode.getConfig().executeCommand("no int " + NodeInt + " shutdown");
          } else {
            tmpNode.getConfig().executeCommand("int " + NodeInt + " shutdown");
          }
          tmpNode.getConfig().executeCommand("write mem");
        } else {
          ((core.SerialNetworkInterface) Sim.getNode(NodeName).getNIC(NodeInt))
              .setClockRate(Integer.valueOf(CR));
          Sim.getNode(NodeName).getNIC(NodeInt).DOWN();
          if (chkUP.isSelected()) {
            Sim.getNode(NodeName).getNIC(NodeInt).UP();
          }
        }

        this.dispose();
      } else {
        lblError.setText("Invalid MAC Address!");
        lblError.setForeground(Color.RED);
        lblError.setVisible(true);
        controller.shakeDiaLog(this);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #5
0
 public void refreshQuickControl() {
   if (this.quickControlView != null) {
     int icon_id = this.getQuickControlIconID();
     Drawable icon = MainScreen.getMainContext().getResources().getDrawable(icon_id);
     ((ImageView) this.quickControlView.findViewById(R.id.imageView)).setImageDrawable(icon);
   }
 }
Example #6
0
  @Override
  public void addInterfaces(MainScreen parent, Node node) {

    String[] choices = {
      "5 Ethernet-TX ports simple switch.",
      "8 Ethernet-TX ports switch.",
      "12 Ethernet-TX ports switch.",
      "24 Ethernet-TX ports switch.",
      "12 Ethernet-TX ports with 2 Ethernet-FX switch.",
      "24 Ethernet-TX ports with 2 Ethernet-FX switch.",
      "12 Ethernet-FX ports with 2 Ethernet-TX switch.",
      "24 Ethernet-FX ports with 2 Ethernet-TX switch."
    };

    String choice =
        parent.getDeviceTypeDialog("Create new switch", "Please choose switch type", choices);

    int tx = 0, fx = 0;

    if (choice.contains(choices[0])) {
      tx = 5;
      fx = 0;
    } else if (choice.contains(choices[1])) {
      tx = 8;
      fx = 0;
    } else if (choice.contains(choices[2])) {
      tx = 12;
      fx = 0;
    } else if (choice.contains(choices[3])) {
      tx = 24;
      fx = 0;
    } else if (choice.contains(choices[4])) {
      tx = 12;
      fx = 2;
    } else if (choice.contains(choices[5])) {
      tx = 24;
      fx = 2;
    } else if (choice.contains(choices[6])) {
      tx = 2;
      fx = 12;
    } else if (choice.contains(choices[7])) {
      tx = 2;
      fx = 24;
    }

    for (int i = 0; i < tx; i++) {
      node.addNetworkInterface(
          core.NetworkInterface.getIntName(core.NetworkInterface.Ethernet10T) + String.valueOf(i),
          core.NetworkInterface.Ethernet10T,
          false);
    }

    for (int i = 0; i < fx; i++) {
      node.addNetworkInterface(
          core.NetworkInterface.getIntName(core.NetworkInterface.Ethernet100FX) + String.valueOf(i),
          core.NetworkInterface.Ethernet100FX,
          false);
    }
  }
Example #7
0
  // Used only in old camera interface (HALv3 don't use it)
  public void setCameraPictureSize() {
    Camera camera = CameraController.getCamera();
    if (null == camera) return;

    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(MainScreen.getMainContext());
    int jpegQuality = Integer.parseInt(prefs.getString(MainScreen.sJPEGQualityPref, "95"));

    Camera.Parameters cp = CameraController.getInstance().getCameraParameters();
    cp.setPictureSize(MainScreen.getImageWidth(), MainScreen.getImageHeight());
    cp.setJpegQuality(jpegQuality);
    try {
      CameraController.getInstance().setCameraParameters(cp);
    } catch (RuntimeException e) {
      Log.e("CameraTest", "MainScreen.setupCamera unable setParameters " + e.getMessage());
    }
  }
  private void LoginBttnMouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    String username = "******";
    String password = "******";
    String username1 = this.LoginField.getText();
    String password2 = this.PasswordField.getText();

    if ((username1.equals(username)) && (password2.equals(password))) {
      MainScreen w2 = new MainScreen();
      w2.setVisible(true);
      LoginField.setText("");
      PasswordField.setText("");
    } else {
      LoginField.setText("");
      PasswordField.setText("");
      JOptionPane.showMessageDialog(null, "Login Fail. Try again.");
    }

    // if login is correct, go to next screen
    // if login is incorrect, clear fields and retry
  }
  public void scheduleStop(int seconds) {
    MainScreen.getExecutorService()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                stop();
              }
            },
            seconds,
            TimeUnit.SECONDS);
  }
  public void stop() {
    isRunning = false;
    MainScreen.getExecutorService()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                writeToFile();
              }
            },
            5000,
            TimeUnit.MILLISECONDS);
  }
Example #11
0
 public void makeMenu(Menu menu, int instance) {
   menu.add(m_editTask);
   menu.addSeparator();
   switch (task.getStatus()) {
     case Task.NOT_STARTED:
       menu.addSeparator();
       menu.add(m_markTaskInProgress);
       menu.add(m_markTaskDeferred);
       menu.add(m_markTaskWaiting);
       menu.add(m_markTaskCompleted);
       break;
     case Task.IN_PROGRESS:
       menu.addSeparator();
       menu.add(m_markTaskNotStarted);
       menu.add(m_markTaskDeferred);
       menu.add(m_markTaskWaiting);
       menu.add(m_markTaskCompleted);
       break;
     case Task.COMPLETED:
       break;
     case Task.WAITING:
       menu.addSeparator();
       menu.add(m_markTaskNotStarted);
       menu.add(m_markTaskInProgress);
       menu.add(m_markTaskDeferred);
       menu.add(m_markTaskCompleted);
       break;
     case Task.DEFERRED:
       menu.addSeparator();
       menu.add(m_markTaskNotStarted);
       menu.add(m_markTaskInProgress);
       menu.add(m_markTaskDeferred);
       menu.add(m_markTaskCompleted);
   }
   menu.addSeparator();
   menu.add(m_createTextNote);
   menu.add(m_createVoiceNote);
   if (getLeafFieldWithFocus() instanceof NoteField) {
     menu.add(m_deleteNote);
   }
   menu.addSeparator();
   menu.add(
       new MenuItem("About", 110, 1) {
         public void run() {
           UiApplication.getUiApplication().pushScreen(new AboutScreen());
         }
       });
   super.makeMenu(menu, instance);
 }
Example #12
0
 private void login(Label explainLabel) {
   String mail = mailInput.getText(), password = passwordInput.getText();
   Player player = null;
   try {
     player = MainScreen.handler.loadPlayer(mail, password);
   } catch (Exception e1) {
     explainLabel.setText("Error connecting to server...");
     e1.printStackTrace();
     return;
   }
   if (player == null) {
     explainLabel.setText("User not found,\nCheck the Username or Password.");
     return;
   }
   Files.saveData(mail, password);
   MainScreen.setPlayer(player);
   goToFirstScreen();
 }
Example #13
0
 private static String getString(Attributes attributes, String name, String def) {
   String value = attributes.getValue(name);
   if (MainScreen.isEmptyString(value)) return (def);
   return value;
 }
Example #14
0
 private static int getInt(Attributes attributes, String name, int def) {
   String value = attributes.getValue(name);
   if (MainScreen.isEmptyString(value)) return (def);
   return Integer.parseInt(value);
 }
 private void start_btnMouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_start_btnMouseClicked
   // TODO add your handling code here:
   SelectScreen.getSingleton().setVisible(true);
   MainScreen.getSingleton().setVisible(false);
 } // GEN-LAST:event_start_btnMouseClicked
Example #16
0
  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);
  }
Example #17
0
 protected void goToFirstScreen() {
   setVisible(false);
   MainScreen.firstScreen();
 }
Example #18
0
 /** Function assigned to a fxml button that goes to the Authorization.fxml screen. */
 @FXML
 public void goToSettings() {
   MainScreen.removeObserver(this);
   goToNextScreen("/fxml/Authorization.fxml");
 }
Example #19
0
 public void init() {
   sentScreen = new Form(getName());
   appController.addCommonCommand(sentScreen);
   MainScreen.setTransition(sentScreen);
 }
Example #20
0
  public void selectImageDimension() {
    // ----- Figure how much memory do we have and possibly limit resolution
    long maxMem = Runtime.getRuntime().maxMemory();
    long maxMpix = (maxMem - 1000000) / 3; // 2 x Mpix - result, 1/4 x Mpix
    // x 4 - compressed input jpegs,
    // 1Mb - safe reserve

    // find index selected in preferences
    int prefIdx = -1;
    try {
      prefIdx = Integer.parseInt(MainScreen.getImageSizeIndex());
    } catch (IndexOutOfBoundsException e) {
      prefIdx = -1;
    }

    List<CameraController.Size> cs = CameraController.getResolutionsSizeList();
    // add 8 Mpix for rear camera for HTC One X
    if (Build.MODEL.contains("HTC One X")) {
      if (!CameraController.isFrontCamera()) {
        CameraController.Size additional = null;
        additional = CameraController.getInstance().new Size(3264, 2448);
        additional.setWidth(3264);
        additional.setHeight(2448);
        cs.add(additional);
      }
    }
    int defaultCaptureIdx = -1;
    long defaultCaptureMpix = 0;
    int defaultCaptureWidth = 0;
    int defaultCaptureHeight = 0;
    long CaptureMpix = 0;
    int CaptureWidth = 0;
    int CaptureHeight = 0;
    int CaptureIdx = -1;
    boolean prefFound = false;

    // figure default resolution
    int ii = 0;
    for (CameraController.Size s : cs) {
      long mpix = (long) s.getWidth() * s.getHeight();

      if ((mpix >= CameraController.MIN_MPIX_SUPPORTED) && (mpix < maxMpix)) {
        if (mpix > defaultCaptureMpix && mpix <= MPIX_8) {
          defaultCaptureIdx = ii;
          defaultCaptureMpix = mpix;
          defaultCaptureWidth = s.getWidth();
          defaultCaptureHeight = s.getHeight();
        }
      }

      ii++;
    }

    ii = 0;
    for (CameraController.Size s : cs) {
      long mpix = (long) s.getWidth() * s.getHeight();

      if ((Integer.parseInt(CameraController.getResolutionsIdxesList().get(ii)) == prefIdx)
          && (mpix >= CameraController.MIN_MPIX_SUPPORTED)) {
        prefFound = true;
        CaptureIdx = ii;
        CaptureMpix = mpix;
        CaptureWidth = s.getWidth();
        CaptureHeight = s.getHeight();
        break;
      }

      if (mpix > CaptureMpix) {
        CaptureIdx = ii;
        CaptureMpix = mpix;
        CaptureWidth = s.getWidth();
        CaptureHeight = s.getHeight();
      }

      ii++;
    }

    // default to about 8Mpix if nothing is set in preferences or maximum
    // resolution is above memory limits
    if (defaultCaptureMpix > 0) {
      if (!prefFound) {
        CaptureIdx = defaultCaptureIdx;
        CaptureMpix = defaultCaptureMpix;
        CaptureWidth = defaultCaptureWidth;
        CaptureHeight = defaultCaptureHeight;
      }
    }

    CameraController.setCameraImageSizeIndex(CaptureIdx);
    MainScreen.setImageWidth(CaptureWidth);
    MainScreen.setImageHeight(CaptureHeight);

    MainScreen.setSaveImageWidth(CaptureWidth);
    MainScreen.setSaveImageHeight(CaptureHeight);
  }