fix: refresh amounts instantly on hide toggle

This commit is contained in:
Kyle 🐆 2025-10-18 16:38:00 -04:00 committed by Kyle Santiago
parent 4bd622bcfc
commit a8bb094605
9 changed files with 49 additions and 0 deletions

View file

@ -284,6 +284,10 @@ public class TransactionDiagram extends GridPane {
contextMenu.getItems().add(menuItem);
setOnContextMenuRequested(contextMenuHandler);
}
if(getLabel() != null) {
getLabel().update(this);
}
}
private List<Map<BlockTransactionHashIndex, WalletNode>> getDisplayedUtxoSets() {

View file

@ -133,4 +133,15 @@ public class UtxosChart extends BarChart<String, Number> {
NumberAxis yaxis = (NumberAxis)getYAxis();
yaxis.setTickLabelFormatter(new CoinAxisFormatter(yaxis, format, unit));
}
public void refreshAxisLabels() {
NumberAxis yaxis = (NumberAxis)getYAxis();
// Force the axis to redraw by invalidating the upper and lower bounds
yaxis.setAutoRanging(false);
double lower = yaxis.getLowerBound();
double upper = yaxis.getUpperBound();
yaxis.setLowerBound(lower);
yaxis.setUpperBound(upper);
yaxis.setAutoRanging(true);
}
}

View file

@ -1781,6 +1781,12 @@ public class HeadersController extends TransactionFormController implements Init
}
}
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
transactionDiagram.update();
fee.refresh();
}
private static class WalletSignComparator implements Comparator<Wallet> {
private static final List<KeystoreSource> sourceOrder = List.of(KeystoreSource.SW_WATCH, KeystoreSource.HW_AIRGAPPED, KeystoreSource.HW_USB, KeystoreSource.SW_SEED);

View file

@ -578,4 +578,9 @@ public class InputController extends TransactionFormController implements Initia
updateInputLegendFromWallet(inputForm.getTransactionInput(), null);
}
}
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
spends.refresh();
}
}

View file

@ -184,4 +184,9 @@ public class InputsController extends TransactionFormController implements Initi
updatePSBTInputs(inputsForm.getPsbt());
}
}
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
total.refresh();
}
}

View file

@ -228,4 +228,9 @@ public class OutputController extends TransactionFormController implements Initi
updateScriptPubKey(outputForm.getTransactionOutput());
}
}
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
value.refresh();
}
}

View file

@ -6,6 +6,7 @@ import com.sparrowwallet.drongo.protocol.TransactionOutput;
import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.control.CopyableCoinLabel;
import com.sparrowwallet.sparrow.control.CopyableLabel;
import com.sparrowwallet.sparrow.event.HideAmountsStatusEvent;
import com.sparrowwallet.sparrow.event.TransactionOutputsChangedEvent;
import com.sparrowwallet.sparrow.event.UnitFormatChangedEvent;
import javafx.fxml.FXML;
@ -68,4 +69,9 @@ public class OutputsController extends TransactionFormController implements Init
updatePieData(outputsPie, outputsForm.getTransaction().getOutputs());
}
}
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
total.refresh();
}
}

View file

@ -132,6 +132,12 @@ public class AddressesController extends WalletFormController implements Initial
changeTable.showTransactionsCount(event.isShowCount());
}
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
receiveTable.refresh();
changeTable.refresh();
}
public void exportReceiveAddresses(ActionEvent event) {
exportAddresses(KeyPurpose.RECEIVE);
}

View file

@ -278,6 +278,7 @@ public class UtxosController extends WalletFormController implements Initializab
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
utxosTable.refresh();
utxosChart.update(getWalletForm().getWalletUtxosEntry());
utxosChart.refreshAxisLabels();
balance.refresh();
mempoolBalance.refresh();
updateButtons(Config.get().getUnitFormat(), Config.get().getBitcoinUnit());