mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-18 19:28:08 -04:00
move processing off UserThread for smoother experience
This commit is contained in:
parent
ba9a9a3dcc
commit
e6775f3b58
16 changed files with 276 additions and 215 deletions
|
@ -20,6 +20,7 @@ package haveno.desktop.main.funds.deposit;
|
|||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
import haveno.common.UserThread;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.trade.HavenoUtils;
|
||||
import haveno.core.util.coin.CoinFormatter;
|
||||
|
@ -65,9 +66,11 @@ class DepositListItem {
|
|||
balanceListener = new XmrBalanceListener(addressEntry.getSubaddressIndex()) {
|
||||
@Override
|
||||
public void onBalanceChanged(BigInteger balance) {
|
||||
DepositListItem.this.balanceAsBI = balance;
|
||||
DepositListItem.this.balance.set(HavenoUtils.formatXmr(balanceAsBI));
|
||||
updateUsage(addressEntry.getSubaddressIndex(), null);
|
||||
UserThread.execute(() -> {
|
||||
DepositListItem.this.balanceAsBI = balance;
|
||||
DepositListItem.this.balance.set(HavenoUtils.formatXmr(balanceAsBI));
|
||||
updateUsage(addressEntry.getSubaddressIndex(), null);
|
||||
});
|
||||
}
|
||||
};
|
||||
xmrWalletService.addBalanceListener(balanceListener);
|
||||
|
|
|
@ -902,13 +902,15 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
|
||||
takeOfferBox.getChildren().add(takeOfferButton);
|
||||
takeOfferBox.visibleProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
fundingHBox.getChildren().remove(cancelButton2);
|
||||
takeOfferBox.getChildren().add(cancelButton2);
|
||||
} else if (!fundingHBox.getChildren().contains(cancelButton2)) {
|
||||
takeOfferBox.getChildren().remove(cancelButton2);
|
||||
fundingHBox.getChildren().add(cancelButton2);
|
||||
}
|
||||
UserThread.execute(() -> {
|
||||
if (newValue) {
|
||||
fundingHBox.getChildren().remove(cancelButton2);
|
||||
takeOfferBox.getChildren().add(cancelButton2);
|
||||
} else if (!fundingHBox.getChildren().contains(cancelButton2)) {
|
||||
takeOfferBox.getChildren().remove(cancelButton2);
|
||||
fundingHBox.getChildren().add(cancelButton2);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
cancelButton2 = new AutoTooltipButton(Res.get("shared.cancel"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue