save app width and height across restarts

This commit is contained in:
Craig Raw 2021-08-16 11:25:18 +02:00
parent 90355a653f
commit a3e4342d7d
2 changed files with 27 additions and 0 deletions

View file

@ -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();

View file

@ -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;
} }