Sorry was too fast with an untested ACK and merge.

- The icon loses it's color so its always black now. I think we should
stick with the colors.
- The duration was set to 10 seconds. I thinks that is too long.
- Not clear what the 'Object a = new Object() {{' definition means. I
assume you want a initializer block instead
('{ itemProperty().addListener.... }')
- We should maybe better make a small component out of that button
which behaves similar like the checkbox or radio button animation.
Maybe we can use those components instead of a normal button.
Or maybe the normal button animation from the new UI framework is enough.
This commit is contained in:
Manfred Karrer 2018-12-09 20:21:37 +01:00
parent 7f6aa8f80a
commit f7572cdca6
No known key found for this signature in database
GPG key ID: 401250966A6B2C46

View file

@ -29,18 +29,12 @@ import bisq.core.util.BsqFormatter;
import de.jensd.fx.fontawesome.AwesomeIcon;
import javafx.animation.FillTransition;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.beans.value.ChangeListener;
import javafx.util.Duration;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@ -79,10 +73,6 @@ public class ProposalsListItem {
@Getter
private Button iconButton;
// A Shape used to perform fill transition, never to be shown. The Cell listens to the Shape's fill property.
@Getter
private Rectangle colorTransition;
private ChangeListener<DaoPhase.Phase> phaseChangeListener;
///////////////////////////////////////////////////////////////////////////////////////////
@ -116,8 +106,6 @@ public class ProposalsListItem {
daoFacade.phaseProperty().addListener(phaseChangeListener);
onPhaseChanged(daoFacade.phaseProperty().get());
colorTransition = new Rectangle(1, 1, new Color(0, 0, 0, 0));
}
@ -125,12 +113,6 @@ public class ProposalsListItem {
// API
///////////////////////////////////////////////////////////////////////////////////////////
public void setVote(@Nullable Vote vote) {
if (ballot != null && ballot.getVote() != vote)
onVoteChanged(vote);
daoFacade.setVote(ballot, vote);
}
public void cleanup() {
daoFacade.phaseProperty().removeListener(phaseChangeListener);
}
@ -186,25 +168,6 @@ public class ProposalsListItem {
}
}
private void onVoteChanged(Vote to) {
// TODO: Get colors from css directly, for styles:
// dao-accepted-icon, dao-rejected-icon, dao-ignored-icon
Color fromColor = Color.web("25B135", 0.5);
Color toColor = Color.web("25B135", 0);
if (to == null) {
fromColor = Color.web("AAAAAA", 0.5);
toColor = Color.web("AAAAAA", 0);
} else if (!to.isAccepted()) {
fromColor = Color.web("dd0000", 0.5);
toColor = Color.web("dd0000", 0);
}
FillTransition ft = new FillTransition(Duration.millis(10000), colorTransition, fromColor, toColor);
ft.setCycleCount(1);
ft.setAutoReverse(false);
ft.play();
}
private String getNext(IconButtonTypes iconButtonTypes) {
if (iconButtonTypes == IconButtonTypes.ACCEPT)
return IconButtonTypes.REJECT.getTitle();