All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.squareup.spoon.DeviceUtils Maven / Gradle / Ivy

There is a newer version: 1.7.1
Show newest version
package com.squareup.spoon;

final class DeviceUtils {
  /** Scrub the model so that it does not contain redundant data. */
  static String scrubModel(String manufacturer, String model) {
    if (manufacturer == null || model == null) {
      return model;
    }
    if (model.regionMatches(true, 0, manufacturer, 0, manufacturer.length())) {
      model = model.substring(manufacturer.length());
    }
    if (model.length() > 0 && (model.charAt(0) == ' ' || model.charAt(0) == '-')) {
      model = model.substring(1);
    }
    return model;
  }

  /** Scrub the language so it does not contain bad data. */
  static String scrubLanguage(String language) {
    if ("ldpi".equals(language)
        || "mdpi".equals(language)
        || "hdpi".equals(language)
        || "xhdpi".equals(language)) {
      return null; // HTC, you suck!
    }
    return language;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy