Skip to content

Commit

Permalink
Added possibility to save and restore settings about layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
judovana committed Dec 13, 2015
1 parent 166f90b commit 145dc81
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ run.test.classpath=\
source.encoding=UTF-8
src.dir=src
test.src.dir=test
Application.version = 1.2
Application.version = 1.3
30 changes: 30 additions & 0 deletions src/org/fbb/balkna/model/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class Settings {
private static final boolean allowSkippingDefault = false;
private static final boolean pauseOnChangeDefault = false;
private static final boolean pauseOnExerciseDefault = false;
private static final boolean invertScreenCompressDefault = false;
private static final boolean allowScreenChangeDefault = true;
private static final boolean ratioForcedDefault = true;
private static final int imagesOnTimerSpeedDefault = 2;
private static final String forcedLanguageDefault = null;
Expand All @@ -42,6 +44,8 @@ public class Settings {
private boolean pauseOnChange = pauseOnChangeDefault;
private boolean pauseOnExercise = pauseOnExerciseDefault;
private boolean ratioForced = ratioForcedDefault;
private boolean invertScreenCompress = invertScreenCompressDefault;
private boolean allowScreenChange = allowScreenChangeDefault;
private int imagesOnTimerSpeed = imagesOnTimerSpeedDefault;
private String forcedLanguage = forcedLanguageDefault;
private String forcedSoundFont = forcedSoundFontDefault;
Expand Down Expand Up @@ -176,6 +180,8 @@ void save(File dir) throws UnsupportedEncodingException, FileNotFoundException,
writeObjectAsProperty("imagesOnTimerSpeed", imagesOnTimerSpeed, imagesOnTimerSpeedDefault, fw);
writeObjectAsProperty("forcedLanguage", forcedLanguage, forcedLanguageDefault, fw);
writeObjectAsProperty("forcedSoundFont", forcedSoundFont, forcedSoundFontDefault, fw);
writeObjectAsProperty("allowScreenChange", allowScreenChange, allowScreenChangeDefault, fw);
writeObjectAsProperty("invertScreenCompress", invertScreenCompress, invertScreenCompressDefault, fw);
} finally {
fw.close();
}
Expand All @@ -198,6 +204,10 @@ public void readItem(String key, String value) {
allowSkipping = Boolean.valueOf(value);
} else if (key.equals("pauseOnChange")) {
pauseOnChange = Boolean.valueOf(value);
} else if (key.equals("allowScreenChange")) {
allowScreenChange = Boolean.valueOf(value);
} else if (key.equals("invertScreenCompress")) {
invertScreenCompress = Boolean.valueOf(value);
} else if (key.equals("pauseOnExercise")) {
pauseOnExercise = Boolean.valueOf(value);
} else if (key.equals("ratioForced")) {
Expand All @@ -220,6 +230,10 @@ public String[] listItems() {
" Default: " + objectAsPropertyString("laud", laudDefault),
objectAsPropertyString("allowSkipping", allowSkipping),
" Default: " + objectAsPropertyString("allowSkipping", allowSkippingDefault),
objectAsPropertyString("allowScreenChange", allowScreenChange),
" Default: " + objectAsPropertyString("allowScreenChange", allowScreenChangeDefault),
objectAsPropertyString("invertScreenCompress", invertScreenCompress),
" Default: " + objectAsPropertyString("invertScreenCompress", invertScreenCompressDefault),
objectAsPropertyString("pauseOnChange", pauseOnChange),
" Default: " + objectAsPropertyString("pauseOnChange", pauseOnChangeDefault),
objectAsPropertyString("pauseOnExercise", pauseOnExercise),
Expand Down Expand Up @@ -291,4 +305,20 @@ public static Settings getSettings() {
return SettingsHolder.getInstance();
}

public boolean isAllowScreenChange() {
return allowScreenChange;
}

public boolean isInvertScreenCompress() {
return invertScreenCompress;
}

public void setAllowScreenChange(boolean allowScreenChange) {
this.allowScreenChange = allowScreenChange;
}

public void setInvertScreenCompress(boolean invertScreenCompress) {
this.invertScreenCompress = invertScreenCompress;
}

}
2 changes: 2 additions & 0 deletions src/org/fbb/balkna/swing/locales/bundles/Messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Close=Save and close
Export=Export current training to Html
ExportAndroid=Export current training to Html via long touch on description
Upload=Download following jar as trainings
alowScreenChange=Allow the dynamical changes of layout when items in training are clicked
invertScreenLayout=Invert default behavior, when small screens show main training view

jumpBack=Jump back
# not localised, there is logoc on this button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Close=Ulo\u017eit a zav\u0159\u00edt
Export=Export prob\u00edhaj\u00edc\u00ed tr\u00e9nink do html
ExportAndroid=Tr\u00e9nink exportujete podr\u017een\u00edm na popisu tr\u00e9inku v hlavn\u00ed obrazovce
Upload=St\u00e1hnout archiv s tr\u00e9ninky
alowScreenChange=Povolit zm\u011bny rozlo\u017een\u00ed tr\u00e9ninkov\u00e9 obrazovky klik\u00e1n\u00edm na jej\u00ed \u010d\u00e1sti
invertScreenLayout=Obr\u00e1tit defaultn\u00ed nastaven\u00ed kdy, mal\u00e9 displeje ukazuj\u00ed v tr\u00e9ninku pouze to hlavn\u00ed

jumpBack=Skok zp\u011bt
# not localised, there is logic on this button
Expand Down

0 comments on commit 145dc81

Please sign in to comment.