Validating advanced and screen settings.
This commit is contained in:
parent
d8858cf19f
commit
6f57b090a6
@ -43,6 +43,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
private PerformanceFlags performanceFlags;
|
||||
private AdvancedSettings advancedSettings;
|
||||
private DebugSettings debugSettings;
|
||||
|
||||
public BookmarkBase(Parcel parcel) {
|
||||
type = parcel.readInt();
|
||||
id = parcel.readLong();
|
||||
@ -60,6 +61,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
debugSettings = parcel.readParcelable(DebugSettings.class
|
||||
.getClassLoader());
|
||||
}
|
||||
|
||||
public BookmarkBase() {
|
||||
init();
|
||||
}
|
||||
@ -539,6 +541,39 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
height = parcel.readInt();
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
switch (colors) {
|
||||
case 32:
|
||||
case 24:
|
||||
case 16:
|
||||
case 15:
|
||||
case 8:
|
||||
break;
|
||||
default:
|
||||
colors = 32;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((width <= 0) || (width > 65536)) {
|
||||
width = 1024;
|
||||
}
|
||||
|
||||
if ((height <= 0) || (height > 65536)) {
|
||||
height = 768;
|
||||
}
|
||||
|
||||
switch(resolution) {
|
||||
case FITSCREEN:
|
||||
case AUTOMATIC:
|
||||
case CUSTOM:
|
||||
case PREDEFINED:
|
||||
break;
|
||||
default:
|
||||
resolution = AUTOMATIC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
resolution = AUTOMATIC;
|
||||
colors = 16;
|
||||
@ -587,22 +622,27 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
|
||||
public boolean isPredefined() {
|
||||
validate();
|
||||
return (resolution == PREDEFINED);
|
||||
}
|
||||
|
||||
public boolean isAutomatic() {
|
||||
validate();
|
||||
return (resolution == AUTOMATIC);
|
||||
}
|
||||
|
||||
public boolean isFitScreen() {
|
||||
validate();
|
||||
return (resolution == FITSCREEN);
|
||||
}
|
||||
|
||||
public boolean isCustom() {
|
||||
validate();
|
||||
return (resolution == CUSTOM);
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
validate();
|
||||
return width;
|
||||
}
|
||||
|
||||
@ -611,6 +651,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
validate();
|
||||
return height;
|
||||
}
|
||||
|
||||
@ -619,6 +660,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
|
||||
public int getColors() {
|
||||
validate();
|
||||
return colors;
|
||||
}
|
||||
|
||||
@ -698,6 +740,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
|
||||
this.debug = "INFO";
|
||||
}
|
||||
|
||||
public String getDebugLevel() {
|
||||
validate();
|
||||
return debug;
|
||||
@ -810,7 +853,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
switch(redirectSound) {
|
||||
switch (redirectSound) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
@ -820,7 +863,7 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
break;
|
||||
}
|
||||
|
||||
switch(security) {
|
||||
switch (security) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
|
Loading…
x
Reference in New Issue
Block a user