Skip to content

Commit

Permalink
Refactor: Replace PauseTransition with UIScheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
axpoems committed Apr 7, 2024
1 parent b850ab7 commit 2fc83e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import bisq.desktop.common.view.NavigationController;
import bisq.desktop.main.content.bisq_easy.take_offer.amount.TakeOfferAmountController;
import bisq.desktop.main.content.bisq_easy.take_offer.payment_method.TakeOfferPaymentController;
import bisq.desktop.main.content.bisq_easy.take_offer.price.TakeOfferPriceController;
import bisq.desktop.main.content.bisq_easy.take_offer.review.TakeOfferReviewController;
import bisq.desktop.overlay.OverlayController;
import bisq.i18n.Res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop.main.content.bisq_easy.take_offer.review;

import bisq.desktop.common.Transitions;
import bisq.desktop.common.threading.UIScheduler;
import bisq.desktop.common.view.View;
import bisq.desktop.components.containers.Spacer;
import bisq.desktop.components.controls.MultiStyleLabelPane;
Expand All @@ -26,15 +27,18 @@
import bisq.desktop.main.content.bisq_easy.components.WaitingState;
import bisq.desktop.main.content.bisq_easy.take_offer.TakeOfferView;
import bisq.i18n.Res;
import javafx.animation.PauseTransition;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
import javafx.util.Duration;
import lombok.extern.slf4j.Slf4j;
import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.Subscription;
Expand Down Expand Up @@ -192,15 +196,13 @@ private void showTakeOfferStatusFeedback(TakeOfferReviewModel.TakeOfferStatus st
Transitions.slideInTop(takeOfferStatus, 450);
takeOfferSendMessageWaitingAnimation.playIndefinitely();

PauseTransition delay = new PauseTransition(Duration.seconds(8));
delay.setOnFinished(e -> {
UIScheduler.run(() -> {
minWaitingTimePassed = true;
if (model.getTakeOfferStatus().get() == TakeOfferReviewModel.TakeOfferStatus.SUCCESS) {
takeOfferStatus.getChildren().setAll(takeOfferSuccess, Spacer.fillVBox());
takeOfferSendMessageWaitingAnimation.stop();
}
});
delay.play();
}).after(8000);
} else if (status == TakeOfferReviewModel.TakeOfferStatus.SUCCESS && minWaitingTimePassed) {
takeOfferStatus.getChildren().setAll(takeOfferSuccess, Spacer.fillVBox());
takeOfferSendMessageWaitingAnimation.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import bisq.account.payment_method.FiatPaymentMethod;
import bisq.desktop.common.Transitions;
import bisq.desktop.common.threading.UIScheduler;
import bisq.desktop.common.view.View;
import bisq.desktop.components.containers.Spacer;
import bisq.desktop.components.controls.MultiStyleLabelPane;
Expand All @@ -28,16 +29,19 @@
import bisq.desktop.main.content.bisq_easy.take_offer.TakeOfferView;
import bisq.desktop.main.content.bisq_easy.trade_wizard.TradeWizardView;
import bisq.i18n.Res;
import javafx.animation.PauseTransition;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
import javafx.util.Duration;
import javafx.util.StringConverter;
import lombok.extern.slf4j.Slf4j;
import org.fxmisc.easybind.EasyBind;
Expand Down Expand Up @@ -274,15 +278,13 @@ private void showTakeOfferStatusFeedback(TradeWizardReviewModel.TakeOfferStatus
Transitions.slideInTop(takeOfferStatus, 450);
takeOfferSendMessageWaitingAnimation.playIndefinitely();

PauseTransition delay = new PauseTransition(Duration.seconds(8));
delay.setOnFinished(e -> {
UIScheduler.run(() -> {
minWaitingTimePassed = true;
if (model.getTakeOfferStatus().get() == TradeWizardReviewModel.TakeOfferStatus.SUCCESS) {
takeOfferStatus.getChildren().setAll(takeOfferSuccess, Spacer.fillVBox());
takeOfferSendMessageWaitingAnimation.stop();
}
});
delay.play();
}).after(8000);
} else if (status == TradeWizardReviewModel.TakeOfferStatus.SUCCESS && minWaitingTimePassed) {
takeOfferStatus.getChildren().setAll(takeOfferSuccess, Spacer.fillVBox());
takeOfferSendMessageWaitingAnimation.stop();
Expand Down

0 comments on commit 2fc83e9

Please sign in to comment.