Skip to content

Commit

Permalink
[FIXED JENKINS-13313] Removed warning about suspect screen resolution…
Browse files Browse the repository at this point in the history
… values.

This doesn't make so much sense since larger screen sizes like tablets and TVs
became possible, as we don't know what physical screen size the intended device
has, so we don't know whether a density/resolution pair makes sense or not.
  • Loading branch information
orrc committed May 18, 2014
1 parent 92d9c03 commit d9b942b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 47 deletions.
17 changes: 0 additions & 17 deletions src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java
Expand Up @@ -963,23 +963,6 @@ private ValidationResult doCheckScreenResolution(String resolution, String densi
}
}

// Check for shenanigans
ScreenResolution resolutionValue = ScreenResolution.valueOf(resolution);
ScreenDensity densityValue = ScreenDensity.valueOf(density);
if (resolutionValue != null && densityValue != null
&& !resolutionValue.isCustomResolution() && !densityValue.isCustomDensity()) {
boolean densityFound = false;
for (ScreenDensity okDensity : resolutionValue.getApplicableDensities()) {
if (okDensity.equals(densityValue)) {
densityFound = true;
break;
}
}
if (!densityFound) {
return ValidationResult.warning(Messages.SUSPECT_RESOLUTION(resolution, densityValue));
}
}

return ValidationResult.ok();
}

Expand Down
41 changes: 12 additions & 29 deletions src/main/java/hudson/plugins/android_emulator/Constants.java
Expand Up @@ -218,26 +218,16 @@ class ScreenResolution implements Serializable {

private static final long serialVersionUID = 1L;

static final ScreenResolution QVGA = new ScreenResolution(240, 320, "QVGA", "QVGA",
ScreenDensity.LOW);
static final ScreenResolution WQVGA = new ScreenResolution(240, 400, "WQVGA", "WQVGA400",
ScreenDensity.LOW);
static final ScreenResolution FWQVGA = new ScreenResolution(240, 432, "FWQVGA", "WQVGA432",
ScreenDensity.LOW);
static final ScreenResolution HVGA = new ScreenResolution(320, 480, "HVGA", "HVGA",
ScreenDensity.MEDIUM);
static final ScreenResolution WVGA = new ScreenResolution(480, 800, "WVGA", "WVGA800",
ScreenDensity.MEDIUM, ScreenDensity.HIGH);
static final ScreenResolution FWVGA = new ScreenResolution(480, 854, "FWVGA", "WVGA854",
ScreenDensity.MEDIUM, ScreenDensity.HIGH);
static final ScreenResolution WSVGA = new ScreenResolution(1024, 654, "WSVGA", "WSVGA",
ScreenDensity.MEDIUM, ScreenDensity.HIGH);
static final ScreenResolution WXGA_720 = new ScreenResolution(1280, 720, "WXGA720", "WXGA720",
ScreenDensity.MEDIUM);
static final ScreenResolution WXGA_800 = new ScreenResolution(1280, 800, "WXGA800", "WXGA800",
ScreenDensity.MEDIUM);
static final ScreenResolution WXGA = new ScreenResolution(1280, 800, "WXGA", "WXGA",
ScreenDensity.MEDIUM);
static final ScreenResolution QVGA = new ScreenResolution(240, 320, "QVGA", "QVGA");
static final ScreenResolution WQVGA = new ScreenResolution(240, 400, "WQVGA", "WQVGA400");
static final ScreenResolution FWQVGA = new ScreenResolution(240, 432, "FWQVGA", "WQVGA432");
static final ScreenResolution HVGA = new ScreenResolution(320, 480, "HVGA", "HVGA");
static final ScreenResolution WVGA = new ScreenResolution(480, 800, "WVGA", "WVGA800");
static final ScreenResolution FWVGA = new ScreenResolution(480, 854, "FWVGA", "WVGA854");
static final ScreenResolution WSVGA = new ScreenResolution(1024, 654, "WSVGA", "WSVGA");
static final ScreenResolution WXGA_720 = new ScreenResolution(1280, 720, "WXGA720", "WXGA720");
static final ScreenResolution WXGA_800 = new ScreenResolution(1280, 800, "WXGA800", "WXGA800");
static final ScreenResolution WXGA = new ScreenResolution(1280, 800, "WXGA", "WXGA");
static final ScreenResolution[] PRESETS = new ScreenResolution[] { QVGA, WQVGA, FWQVGA, HVGA,
WVGA, FWVGA, WSVGA,
WXGA_720, WXGA_800, WXGA };
Expand All @@ -246,19 +236,16 @@ class ScreenResolution implements Serializable {
private final int height;
private final String alias;
private final String skinName;
private final ScreenDensity[] densities;

private ScreenResolution(int width, int height, String alias, String skinName,
ScreenDensity... applicableDensities) {
private ScreenResolution(int width, int height, String alias, String skinName) {
this.width = width;
this.height = height;
this.alias = alias;
this.skinName = skinName;
this.densities = applicableDensities;
}

private ScreenResolution(int width, int height) {
this(width, height, null, null, (ScreenDensity[]) null);
this(width, height, null, null);
}

public static ScreenResolution valueOf(String resolution) {
Expand Down Expand Up @@ -311,10 +298,6 @@ public String getSkinName() {
return skinName;
}

public ScreenDensity[] getApplicableDensities() {
return densities;
}

public String getDimensionString() {
return width +"x"+ height;
}
Expand Down
Expand Up @@ -14,7 +14,6 @@ SCREEN_DENSITY_REQUIRED=Screen density is required
SCREEN_DENSITY_NOT_NUMERIC=Screen density should be a number
SCREEN_RESOLUTION_REQUIRED=Screen resolution is required
INVALID_RESOLUTION_FORMAT=Resolution should be xVGA, or WWWxHHH
SUSPECT_RESOLUTION={0} resolution with density of {1}dpi.. are you sure?
SUSPECT_RESOLUTION_ANDROID_3=That doesn''t look right for Android {0}. Did you mean WXGA?
SUSPECT_RESOLUTION_ANDROID_4=That doesn''t look right for Android {0}. Did you mean WXGA720 or WXGA800?
DEFAULT_LOCALE_WARNING=Locale will default to ''{0}'' if not specified
Expand Down

0 comments on commit d9b942b

Please sign in to comment.