Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package hudson.plugins.android_emulator;
  
  import  hudson.Util;
  
  
  interface Constants {

    
The locale to which Android emulators default if not otherwise specified.
  
     static final String DEFAULT_LOCALE = "en_US";
 
     static final String[] EMULATOR_LOCALES = {
         "cs_CZ""de_AT""de_CH""de_DE""de_LI""en_AU""en_CA""en_GB",
         "en_NZ""en_SG""en_US""fr_BE""fr_CA""fr_CH""fr_FR""it_CH",
         "it_IT""ja_JP""ko_KR""nl_BE""nl_NL""pl_PL""ru_RU""zh_TW"
     };
 
     static final String REGEX_AVD_NAME = "[a-zA-Z0-9._-]+";
     static final String REGEX_LOCALE = "[a-z]{2}_[A-Z]{2}";
     static final String REGEX_SCREEN_DENSITY = "[0-9]{2,4}|(?i)(x?h|[lm])dpi";
     static final String REGEX_SCREEN_RESOLUTION = "[0-9]{3,4}x[0-9]{3,4}";
     static final String REGEX_SCREEN_RESOLUTION_ALIAS = "([HQ]|F?WQ?)VGA";
     static final String REGEX_SD_CARD_SIZE = "(?i)([0-9]{1,12}) ?([KM])[B]?";
 
 }
 
 enum Tool {
     ADB("adb"".exe"true),
     ANDROID("android"".bat"),
     EMULATOR("emulator"".exe"),
     MKSDCARD("mksdcard"".exe");
 
     final String executable;
     final String windowsExtension;
     final boolean isPlatformTool;
 
     Tool(String executableString windowsExtension) {
         this(executablewindowsExtensionfalse);
     }
 
     Tool(String executableString windowsExtensionboolean isPlatformTool) {
         this. = executable;
         this. = windowsExtension;
         this. = isPlatformTool;
     }
 
     String getExecutable(boolean isUnix) {
         if (isUnix) {
             return ;
         }
         return  + ;
     }
 
     static String[] getAllExecutableVariants() {
         final Tool[] tools = values();
         String[] executables = new String[tools.length * 2];
         for (int i = 0, n = tools.lengthi < ni++) {
             executables[i*2] = tools[i].getExecutable(true);
             executables[i*2+1] = tools[i].getExecutable(false);
         }
 
         return executables;
     }
 
 }
 
 class AndroidSdk implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
     private final String sdkHome;
     private boolean usesPlatformTools;
 
     AndroidSdk(String home) {
         this. = home;
     }
 
     boolean hasKnownRoot() {
         return this. != null;
     }
 
     String getSdkRoot() {
         return this.;
     }
 
     boolean usesPlatformTools() {
         return this.;
     }
 
     void setUsesPlatformTools(boolean usesPlatformTools) {
         this. = usesPlatformTools;
     }
 
 }
 
 class AndroidPlatform implements Serializable {
 
     private static final long serialVersionUID = 1L;
    static final AndroidPlatform SDK_1_1 = new AndroidPlatform("1.1", 2);
    static final AndroidPlatform SDK_1_5 = new AndroidPlatform("1.5", 3);
    static final AndroidPlatform SDK_1_6 = new AndroidPlatform("1.6", 4);
    static final AndroidPlatform SDK_2_0 = new AndroidPlatform("2.0", 5);
    static final AndroidPlatform SDK_2_0_1 = new AndroidPlatform("2.0.1", 6);
    static final AndroidPlatform SDK_2_1 = new AndroidPlatform("2.1", 7);
    static final AndroidPlatform SDK_2_2 = new AndroidPlatform("2.2", 8);
    static final AndroidPlatform SDK_2_3 = new AndroidPlatform("2.3", 9);
    static final AndroidPlatform[] PRESETS = new AndroidPlatform[] { ,
                                                                      };
    private final String name;
    private final int level;
    private AndroidPlatform(String nameint level) {
        this. = name;
        this. = level;
    }
    private AndroidPlatform(String name) {
        this(name, -1);
    }
    public static AndroidPlatform valueOf(String version) {
        if (Util.fixEmptyAndTrim(version) == null) {
            return null;
        }
        for (AndroidPlatform preset : ) {
            if (version.equals(preset.name) || version.equals(preset.level +"")) {
                return preset;
            }
        }
        return new AndroidPlatform(version);
    }
    public boolean isCustomPlatform() {
        return  == -1;
    }
    public String getTargetName() {
        if (isCustomPlatform()) {
            return ;
        }
        return "android-";
    }
    public String getOldTargetName() {
        return "android-";
    }
    public int getSdkLevel() {
        return ;
    }
    @Override
    public String toString() {
        return ;
    };
class ScreenDensity implements Serializable {
    private static final long serialVersionUID = 1L;
    static final ScreenDensity LOW = new ScreenDensity(120, "ldpi");
    static final ScreenDensity MEDIUM = new ScreenDensity(160, "mdpi");
    static final ScreenDensity HIGH = new ScreenDensity(240, "hdpi");
    static final ScreenDensity EXTRA_HIGH = new ScreenDensity(320, "xhdpi");
    static final ScreenDensity[] PRESETS = new ScreenDensity[] {  };
    private final int dpi;
    private final String alias;
    private ScreenDensity(int dpiString alias) {
        this. = dpi;
        this. = alias;
    }
    private ScreenDensity(String density) {
        this(Integer.parseInt(density), null);
    }
    public static ScreenDensity valueOf(String density) {
        if (Util.fixEmptyAndTrim(density) == null) {
            return null;
        } else {
            density = density.toLowerCase();
        }
        for (ScreenDensity preset : ) {
            if (density.equals(preset.alias) || density.equals(preset.toString())) {
                return preset;
            }
        }
        // Return custom value, if things look valid
        try {
            Integer.parseInt(density);
        } catch (NumberFormatException ex) {
            return null;
        }
        return new ScreenDensity(density);
    }
    public boolean isCustomDensity() {
        return  == null;
    }
    public int getDpi() {
        return ;
    }
    @Override
    public String toString() {
        return Integer.toString();
    };
class ScreenResolution implements Serializable {
    private static final long serialVersionUID = 1L;
    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[] PRESETS = new ScreenResolution[] { ,
                                                                        };
    private final int width;
    private final int height;
    private final String alias;
    private final String skinName;
    private final ScreenDensity[] densities;
    private ScreenResolution(int widthint heightString aliasString skinName,
            ScreenDensity... applicableDensities) {
        this. = width;
        this. = height;
        this. = alias;
        this. = skinName;
        this. = applicableDensities;
    }
    private ScreenResolution(int widthint height) {
        this(widthheightnullnull, (ScreenDensity[]) null);
    }
    public static ScreenResolution valueOf(String resolution) {
        if (Util.fixEmptyAndTrim(resolution) == null) {
            return null;
        }
        // Try matching against aliases
        for (ScreenResolution preset : ) {
            if (resolution.equalsIgnoreCase(preset.alias)) {
                return preset;
            }
        }
        // Check for pixel values
        resolution = resolution.toLowerCase();
        if (!resolution.matches(.)) {
            return null;
        }
        // Try matching against pixel values
        int index = resolution.indexOf('x');
        int width = 0;
        int height = 0;
        try {
            width = Integer.parseInt(resolution.substring(0, index));
            height = Integer.parseInt(resolution.substring(index+1));
        } catch (NumberFormatException ex) {
            return null;
        }
        for (ScreenResolution preset : ) {
            if (width == preset.width && height == preset.height) {
                return preset;
            }
        }
        // Return custom value
        return new ScreenResolution(widthheight);
    }
    public boolean isCustomResolution() {
        return  == null;
    }
    public String getSkinName() {
        if (isCustomResolution()) {
            return getDimensionString();
        }
        return ;
    }
        return ;
    }
    public String getDimensionString() {
        return  +"x";
    }
    @Override
    public String toString() {
        if (isCustomResolution()) {
            return getDimensionString();
        }
        return ;
    };
New to GrepCode? Check out our FAQ X