Browse Source

save app width and height across restarts

terminal
Craig Raw 4 years ago
parent
commit
a3e4342d7d
  1. 7
      src/main/java/com/sparrowwallet/sparrow/MainApp.java
  2. 20
      src/main/java/com/sparrowwallet/sparrow/io/Config.java

7
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())); 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); AppController appController = AppServices.newAppWindow(stage);
if(createNewWallet) { if(createNewWallet) {
@ -119,6 +124,8 @@ public class MainApp extends Application {
@Override @Override
public void stop() throws Exception { public void stop() throws Exception {
AppServices.get().stop(); AppServices.get().stop();
Config.get().setAppWidth(mainStage.getWidth());
Config.get().setAppHeight(mainStage.getHeight());
mainStage.close(); mainStage.close();
if(sparrowInstance != null) { if(sparrowInstance != null) {
sparrowInstance.freeLock(); sparrowInstance.freeLock();

20
src/main/java/com/sparrowwallet/sparrow/io/Config.java

@ -57,6 +57,8 @@ public class Config {
private File electrumServerCert; private File electrumServerCert;
private boolean useProxy; private boolean useProxy;
private String proxyServer; private String proxyServer;
private Double appWidth;
private Double appHeight;
private String scode; private String scode;
private static Config INSTANCE; private static Config INSTANCE;
@ -458,6 +460,24 @@ public class Config {
flush(); 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() { public String getScode() {
return scode; return scode;
} }

Loading…
Cancel
Save