Ejemplo n.º 1
1
  private void playAudio(Media media) {
    if (mediaView.isVisible() == true) {
      mediaView.setVisible(false);
      display.setVisible(true);
    }
    if (mp != null) {
      mp.dispose();
    }

    mp = new MediaPlayer(media);
    mp.play();

    mp.setAudioSpectrumListener(
        (double timestamp, double duration1, float[] magnitudes, float[] phases) -> {
          display.getChildren().clear();
          int i = 0;
          int x = 10;
          double y = root.getScene().getHeight() / 2;
          Random rand = new Random(System.currentTimeMillis());
          for (float phase : phases) {
            int red = rand.nextInt(255);
            int green = rand.nextInt(255);
            int blue = rand.nextInt(255);
            Circle circle = new Circle(10);
            circle.setCenterX(x + i);
            circle.setCenterY(y + (phase * 100));
            circle.setFill(Color.rgb(red, green, blue, .70));
            display.getChildren().add(circle);
            i += 10;
          }
        });
  }
  private void updateIdentity() {
    Identity identity = clientConfiguration.getSelectedIdentity();

    browseNav.setManaged(identity != null);
    contactsNav.setManaged(identity != null);
    syncNav.setManaged(identity != null);
    // inviteNav.setManaged(identity != null);
    selectedIdentity.setVisible(identity != null);
    // feebbackNav.setVisible(identity != null);

    avatarContainer.setVisible(identity != null);
    if (identity == null) {
      return;
    }

    final String currentAlias = identity.getAlias();
    if (currentAlias.equals(lastAlias)) {
      return;
    }

    new AvatarView(e -> currentAlias).getViewAsync(avatarContainer.getChildren()::setAll);
    alias.setText(currentAlias);
    lastAlias = currentAlias;

    if (clientConfiguration.getAccount() == null) {
      return;
    }
    mail.setText(clientConfiguration.getAccount().getUser());
  }
 private void drawerAnimation() {
   Timeline animation;
   if (drawerOpened) {
     toggleLayer.setVisible(true);
     animation =
         new Timeline(
             new KeyFrame(
                 DEFAULT_TIME_ANIM,
                 new KeyValue(nav.translateXProperty(), 0, Interpolator.EASE_OUT),
                 new KeyValue(toggleLayer.opacityProperty(), 0.3)));
   } else {
     animation =
         new Timeline(
             new KeyFrame(
                 DEFAULT_TIME_ANIM,
                 new KeyValue(nav.translateXProperty(), -DEFAULT_WIDTH_NAV, Interpolator.EASE_IN),
                 new KeyValue(toggleLayer.opacityProperty(), 0)));
     animation.setOnFinished(
         evt -> {
           toggleLayer.setOpacity(0);
           toggleLayer.setVisible(false);
         });
   }
   animation.play();
 }
Ejemplo n.º 4
0
  private void playVideo(Media media) {
    timeProgress.setTextFill(Color.WHITE);
    npView.setVisible(true);
    mView.toBack();
    btnPaFull.setImage(new Image("icon/Full_button/full.png"));
    go = true;

    if (mediaView.isVisible() == false) {
      mediaView.setVisible(true);
      display.setVisible(false);
    }

    if (mp != null) {
      mp.dispose();
    }

    mp = new MediaPlayer(media);
    mediaView.setMediaPlayer(mp);
    mediaView.setPreserveRatio(true);

    final DoubleProperty width = mediaView.fitWidthProperty();
    final DoubleProperty height = mediaView.fitHeightProperty();

    width.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width"));
    height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height"));

    mp.play();
  }
  public DrawerLayout() {
    AnchorPane.setTopAnchor(toggleLayer, 0d);
    AnchorPane.setRightAnchor(toggleLayer, 0d);
    AnchorPane.setBottomAnchor(toggleLayer, 0d);
    AnchorPane.setLeftAnchor(toggleLayer, 0d);
    toggleLayer.setBackground(
        new Background(new BackgroundFill(Color.BLACK, new CornerRadii(0d), new Insets(0))));
    toggleLayer.setOpacity(0);
    toggleLayer.setVisible(false);

    toggleLayer.setOnMouseClicked(
        evt -> {
          if (evt.getButton().equals(MouseButton.PRIMARY)) {
            if (drawerOpened) {
              closeDrawer();
            }
          }
        });

    tableScreen.bind(widthProperty().lessThan(responsiveWidth).or(responsiveWidth.isEqualTo(0)));
    tableScreen.addListener(
        (observable, oldValue, newValue) -> {
          responsiveBehavior(newValue);
        });
  }
Ejemplo n.º 6
0
  @Override
  public void onUserJoinedChannel(String channelName, ChatUser chatUser) {
    Platform.runLater(
        () -> {
          addAndGetChannelTab(channelName);

          if (isCurrentUser(chatUser)) {
            connectingProgressPane.setVisible(false);
            chatsTabPane.setVisible(true);
          }
        });
  }
 private void responsiveBehavior(boolean tabletScreen) {
   if (content != null && nav != null) {
     if (tabletScreen) {
       AnchorPane.setLeftAnchor(content, 0d);
       nav.setTranslateX(-DEFAULT_WIDTH_NAV);
     } else {
       AnchorPane.setLeftAnchor(content, DEFAULT_WIDTH_NAV);
       nav.setTranslateX(0);
       toggleLayer.setVisible(false);
       drawerOpened = false;
     }
   }
 }
Ejemplo n.º 8
0
 @Override
 public void onDisconnected(Exception e) {
   connectingProgressPane.setVisible(true);
   chatsTabPane.setVisible(false);
 }