Cleaned up a bit

This commit is contained in:
delvh 2020-07-05 15:37:13 +02:00
parent c5b42385aa
commit 3afe896137
6 changed files with 37 additions and 25 deletions

View File

@ -245,7 +245,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
@ -439,7 +439,7 @@ org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_if_empty
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_if_empty
org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_if_single_item
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_always
@ -450,7 +450,7 @@ org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=true
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_if_empty
org.eclipse.jdt.core.formatter.lineSplit=150
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false

View File

@ -10,27 +10,27 @@ import envoy.exception.EnvoyException;
* Project: <strong>envoy-client</strong><br>
* File: <strong>AudioPlayer.java</strong><br>
* Created: <strong>05.07.2020</strong><br>
*
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta
*/
public final class AudioPlayer {
private final AudioFormat format;
private final AudioFormat format;
private final DataLine.Info info;
private Clip clip;
/**
* Initializes the player with the default audio format.
*
*
* @since Envoy Client v0.1-beta
*/
public AudioPlayer() { this(AudioRecorder.DEFAULT_AUDIO_FORMAT); }
/**
* Initializes the player with a given audio format.
*
*
* @param format the audio format to use
* @since Envoy Client v0.1-beta
*/
@ -47,7 +47,7 @@ public final class AudioPlayer {
/**
* Plays back an audio clip.
*
*
* @param data the data of the clip
* @throws EnvoyException if the play back failed
* @since Envoy Client v0.1-beta
@ -57,7 +57,7 @@ public final class AudioPlayer {
clip = (Clip) AudioSystem.getLine(info);
clip.open(format, data, 0, data.length);
clip.start();
} catch (LineUnavailableException e) {
} catch (final LineUnavailableException e) {
throw new EnvoyException("Cannot play back audio", e);
}
}

View File

@ -22,7 +22,7 @@ public final class AudioRecorder {
/**
* The default audio format used for recording and play back.
*
*
* @since Envoy Client v0.1-beta
*/
public static final AudioFormat DEFAULT_AUDIO_FORMAT = new AudioFormat(16000, 16, 1, true, false);
@ -35,14 +35,14 @@ public final class AudioRecorder {
/**
* Initializes the recorder with the default audio format.
*
*
* @since Envoy Client v0.1-beta
*/
public AudioRecorder() { this(DEFAULT_AUDIO_FORMAT); }
/**
* Initializes the recorder with a given audio format.
*
*
* @param format the audio format to use
* @since Envoy Client v0.1-beta
*/
@ -65,7 +65,7 @@ public final class AudioRecorder {
/**
* Starts the audio recording.
*
*
* @throws EnvoyException if starting the recording failed
* @since Envoy Client v0.1-beta
*/
@ -81,7 +81,7 @@ public final class AudioRecorder {
tempFile = Files.createTempFile("recording", "wav");
// Start the recording
var ais = new AudioInputStream(line);
final var ais = new AudioInputStream(line);
AudioSystem.write(ais, AudioFileFormat.Type.WAVE, tempFile.toFile());
} catch (IOException | LineUnavailableException e) {
throw new EnvoyException("Cannot record voice", e);
@ -90,7 +90,7 @@ public final class AudioRecorder {
/**
* Stops the recording.
*
*
* @return the finished recording
* @throws EnvoyException if finishing the recording failed
* @since Envoy Client v0.1-beta
@ -99,17 +99,17 @@ public final class AudioRecorder {
try {
line.stop();
line.close();
byte[] data = Files.readAllBytes(tempFile);
final byte[] data = Files.readAllBytes(tempFile);
Files.delete(tempFile);
return data;
} catch (IOException e) {
} catch (final IOException e) {
throw new EnvoyException("Cannot save voice recording", e);
}
}
/**
* Cancels the active recording.
*
*
* @since Envoy Client v0.1-beta
*/
public void cancel() {

View File

@ -18,7 +18,7 @@ import envoy.util.EnvoyLog;
* Project: <strong>envoy-client</strong><br>
* File: <strong>AudioControl.java</strong><br>
* Created: <strong>05.07.2020</strong><br>
*
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta
*/
@ -30,7 +30,7 @@ public final class AudioControl extends HBox {
/**
* Initializes the audio control.
*
*
* @param audioData the audio data to play.
* @since Envoy Client v0.1-beta
*/

View File

@ -11,7 +11,6 @@ import javafx.scene.layout.VBox;
import envoy.client.ui.AudioControl;
import envoy.client.ui.IconUtil;
import envoy.data.Attachment.AttachmentType;
import envoy.data.Message;
import envoy.data.Message.MessageStatus;
import envoy.data.User;
@ -41,9 +40,18 @@ public class MessageControl extends VBox {
// Creating the underlying VBox, the dateLabel and the textLabel
super(new Label(dateFormat.format(message.getCreationDate())));
// Voice attachment
if (message.hasAttachment() && message.getAttachment().getType() == AttachmentType.VOICE)
getChildren().add(new AudioControl(message.getAttachment().getData()));
// Handling message attachment display
if (message.hasAttachment()) switch (message.getAttachment().getType()) {
case PICTURE:
break;
case VIDEO:
break;
case VOICE:
getChildren().add(new AudioControl(message.getAttachment().getData()));
break;
case DOCUMENT:
break;
}
final var textLabel = new Label(message.getText());
textLabel.setWrapText(true);

View File

@ -1,4 +1,4 @@
.button, .list-cell {
.button, .list-cell, .progress-bar * {
-fx-background-radius: 5.0em;
}
@ -26,6 +26,10 @@
-fx-text-fill: transparent;
}
.progress-bar{
-fx-progress-color: blue;
}
.online {
-fx-text-fill: limegreen;
}