Skip to content

Commit

Permalink
Validating advanced settings before use.
Browse files Browse the repository at this point in the history
akallabeth committed Mar 9, 2017
1 parent a595602 commit d8858cf
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -278,7 +278,7 @@ public void writeToSharedPreferences(SharedPreferences sharedPrefs) {
editor.putString("bookmark.debug_level",
debugSettings.getDebugLevel());

editor.commit();
editor.apply();
}

// read from shared preferences
@@ -809,6 +809,29 @@ private void init() {
workDir = "";
}

private void validate() {
switch(redirectSound) {
case 0:
case 1:
case 2:
break;
default:
redirectSound = 0;
break;
}

switch(security) {
case 0:
case 1:
case 2:
case 3:
break;
default:
security = 0;
break;
}
}

public boolean getEnable3GSettings() {
return enable3GSettings;
}
@@ -842,6 +865,7 @@ public void setRedirectSDCard(boolean redirectSDCard) {
}

public int getRedirectSound() {
validate();
return redirectSound;
}

@@ -858,6 +882,7 @@ public void setRedirectMicrophone(boolean redirect) {
}

public int getSecurity() {
validate();
return security;
}

0 comments on commit d8858cf

Please sign in to comment.