Fix ThumbCell colors

This commit is contained in:
0xboobface 2018-10-08 17:52:37 +02:00
parent 5adb980da6
commit 37f720abc7
1 changed files with 17 additions and 15 deletions

View File

@ -54,8 +54,8 @@ public class ThumbCell extends StackPane {
private Model model; private Model model;
private ImageView iv; private ImageView iv;
private Rectangle resolutionBackground; private Rectangle resolutionBackground;
private Paint resolutionOnlineColor = new Color(0.22, 0.8, 0.29, 1); private final Paint resolutionOnlineColor = new Color(0.22, 0.8, 0.29, 1);
private Color resolutionOfflineColor = new Color(0.8, 0.28, 0.28, 1); private final Color resolutionOfflineColor = new Color(0.8, 0.28, 0.28, 1);
private Rectangle nameBackground; private Rectangle nameBackground;
private Rectangle topicBackground; private Rectangle topicBackground;
private Rectangle selectionOverlay; private Rectangle selectionOverlay;
@ -67,22 +67,23 @@ public class ThumbCell extends StackPane {
private FadeTransition recordingAnimation; private FadeTransition recordingAnimation;
private int index = 0; private int index = 0;
ContextMenu popup; ContextMenu popup;
private Color colorNormal = Color.BLACK; private final Color colorNormal = Color.BLACK;
private Color colorHighlight = Color.WHITE; private final Color colorHighlight = Color.WHITE;
private Color colorRecording = new Color(0.8, 0.28, 0.28, 1); private final Color colorRecording = new Color(0.8, 0.28, 0.28, 1);
private SimpleBooleanProperty selectionProperty = new SimpleBooleanProperty(false); private SimpleBooleanProperty selectionProperty = new SimpleBooleanProperty(false);
private HttpClient client; private HttpClient client;
private ObservableList<Node> thumbCellList; private ObservableList<Node> thumbCellList;
private boolean mouseHovering = false; private boolean mouseHovering = false;
private boolean recording = false;
public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, HttpClient client) { public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, HttpClient client) {
this.thumbCellList = parent.grid.getChildren(); this.thumbCellList = parent.grid.getChildren();
this.model = model; this.model = model;
this.recorder = recorder; this.recorder = recorder;
this.client = client; this.client = client;
boolean recording = recorder.isRecording(model); recording = recorder.isRecording(model);
iv = new ImageView(); iv = new ImageView();
setImage(model.getPreview()); setImage(model.getPreview());
@ -158,7 +159,8 @@ public class ThumbCell extends StackPane {
setOnMouseEntered((e) -> { setOnMouseEntered((e) -> {
mouseHovering = true; mouseHovering = true;
new ParallelTransition(changeColor(nameBackground, colorNormal, colorHighlight), changeColor(name, colorHighlight, colorNormal)).playFromStart(); Color normal = recording ? colorRecording : colorNormal;
new ParallelTransition(changeColor(nameBackground, normal, colorHighlight), changeColor(name, colorHighlight, normal)).playFromStart();
new ParallelTransition(changeOpacity(topicBackground, 0.7), changeOpacity(topic, 0.7)).playFromStart(); new ParallelTransition(changeOpacity(topicBackground, 0.7), changeOpacity(topic, 0.7)).playFromStart();
if(Config.getInstance().getSettings().determineResolution) { if(Config.getInstance().getSettings().determineResolution) {
resolutionBackground.setVisible(false); resolutionBackground.setVisible(false);
@ -167,9 +169,10 @@ public class ThumbCell extends StackPane {
}); });
setOnMouseExited((e) -> { setOnMouseExited((e) -> {
mouseHovering = false; mouseHovering = false;
new ParallelTransition(changeColor(nameBackground, colorHighlight, colorNormal), changeColor(name, colorNormal, colorHighlight)).playFromStart(); Color normal = recording ? colorRecording : colorNormal;
new ParallelTransition(changeColor(nameBackground, colorHighlight, normal), changeColor(name, normal, colorHighlight)).playFromStart();
new ParallelTransition(changeOpacity(topicBackground, 0), changeOpacity(topic, 0)).playFromStart(); new ParallelTransition(changeOpacity(topicBackground, 0), changeOpacity(topic, 0)).playFromStart();
if(Config.getInstance().getSettings().determineResolution) { if(Config.getInstance().getSettings().determineResolution && !resolutionTag.getText().isEmpty()) {
resolutionBackground.setVisible(true); resolutionBackground.setVisible(true);
resolutionTag.setVisible(true); resolutionTag.setVisible(true);
} }
@ -310,14 +313,13 @@ public class ThumbCell extends StackPane {
} }
private void setRecording(boolean recording) { private void setRecording(boolean recording) {
this.recording = recording;
if(recording) { if(recording) {
//recordingAnimation.playFromStart(); Color c = mouseHovering ? colorHighlight : colorRecording;
colorNormal = colorRecording; nameBackground.setFill(c);
nameBackground.setFill(colorNormal);
} else { } else {
colorNormal = Color.BLACK; Color c = mouseHovering ? colorHighlight : colorNormal;
nameBackground.setFill(colorNormal); nameBackground.setFill(c);
//recordingAnimation.stop();
} }
recordingIndicator.setVisible(recording); recordingIndicator.setVisible(recording);
} }