From a3e4342d7da228c7b197a17efb749e8b36b6e090 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 16 Aug 2021 11:25:18 +0200 Subject: [PATCH] save app width and height across restarts --- .../com/sparrowwallet/sparrow/MainApp.java | 7 +++++++ .../com/sparrowwallet/sparrow/io/Config.java | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index 8bcd82f3..44b7d5e0 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -90,6 +90,11 @@ public class MainApp extends Application { System.setProperty(Wallet.ALLOW_DERIVATIONS_MATCHING_OTHER_SCRIPT_TYPES_PROPERTY, Boolean.toString(!Config.get().isValidateDerivationPaths())); + if(Config.get().getAppHeight() != null && Config.get().getAppWidth() != null) { + mainStage.setWidth(Config.get().getAppWidth()); + mainStage.setHeight(Config.get().getAppHeight()); + } + AppController appController = AppServices.newAppWindow(stage); if(createNewWallet) { @@ -119,6 +124,8 @@ public class MainApp extends Application { @Override public void stop() throws Exception { AppServices.get().stop(); + Config.get().setAppWidth(mainStage.getWidth()); + Config.get().setAppHeight(mainStage.getHeight()); mainStage.close(); if(sparrowInstance != null) { sparrowInstance.freeLock(); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Config.java b/src/main/java/com/sparrowwallet/sparrow/io/Config.java index 41a841de..16c7a668 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Config.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Config.java @@ -57,6 +57,8 @@ public class Config { private File electrumServerCert; private boolean useProxy; private String proxyServer; + private Double appWidth; + private Double appHeight; private String scode; private static Config INSTANCE; @@ -458,6 +460,24 @@ public class Config { flush(); } + public Double getAppWidth() { + return appWidth; + } + + public void setAppWidth(Double appWidth) { + this.appWidth = appWidth; + flush(); + } + + public Double getAppHeight() { + return appHeight; + } + + public void setAppHeight(Double appHeight) { + this.appHeight = appHeight; + flush(); + } + public String getScode() { return scode; }