本文整理了Java中org.robolectric.res.Qualifiers.getPlatformVersion
方法的一些代码示例,展示了Qualifiers.getPlatformVersion
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Qualifiers.getPlatformVersion
方法的具体详情如下:
包路径:org.robolectric.res.Qualifiers
类名称:Qualifiers
方法名:getPlatformVersion
暂无
代码示例来源:origin: robolectric/robolectric
/**
* If the Config already has a version qualifier, do nothing. Otherwise, add a version
* qualifier for the target api level (which comes from the manifest or Config.sdk()).
*
* @deprecated Figure something else out.
*/
@Deprecated
public static String addPlatformVersion(String qualifiers, int apiLevel) {
int versionQualifierApiLevel = Qualifiers.getPlatformVersion(qualifiers);
if (versionQualifierApiLevel == -1) {
if (qualifiers.length() > 0) {
qualifiers += "-";
}
qualifiers += "v" + apiLevel;
}
return qualifiers;
}
代码示例来源:origin: robolectric/robolectric
public static void applyQualifiers(String qualifiersStrs, int apiLevel,
Configuration configuration, DisplayMetrics displayMetrics) {
String[] qualifiersParts = qualifiersStrs.split(" ", 0);
int i = qualifiersParts.length - 1;
// find the index of the left-most qualifier string that doesn't start with '+'
for (; i >= 0 ; i--) {
String qualifiersStr = qualifiersParts[i];
if (qualifiersStr.startsWith("+")) {
qualifiersParts[i] = qualifiersStr.substring(1);
} else {
break;
}
}
for (i = (i < 0) ? 0 : i; i < qualifiersParts.length ; i++) {
String qualifiersStr = qualifiersParts[i];
int platformVersion = Qualifiers.getPlatformVersion(qualifiersStr);
if (platformVersion != -1 && platformVersion != apiLevel) {
throw new IllegalArgumentException(
"Cannot specify conflicting platform version in qualifiers: \"" + qualifiersStr + "\"");
}
Qualifiers qualifiers = Qualifiers.parse(qualifiersStr);
DeviceConfig.applyToConfiguration(qualifiers, apiLevel, configuration, displayMetrics);
}
DeviceConfig.applyRules(configuration, displayMetrics, apiLevel);
fixJellyBean(configuration, displayMetrics);
}
代码示例来源:origin: org.robolectric/robolectric-resources
public static String addPlatformVersion(String qualifiers, int apiLevel) {
int versionQualifierApiLevel = Qualifiers.getPlatformVersion(qualifiers);
if (versionQualifierApiLevel == -1) {
if (qualifiers.length() > 0) {
qualifiers += "-";
}
qualifiers += "v" + apiLevel;
}
return qualifiers;
}
代码示例来源:origin: org.robolectric/resources
/**
* If the Config already has a version qualifier, do nothing. Otherwise, add a version
* qualifier for the target api level (which comes from the manifest or Config.sdk()).
*
* @deprecated Figure something else out.
*/
@Deprecated
public static String addPlatformVersion(String qualifiers, int apiLevel) {
int versionQualifierApiLevel = Qualifiers.getPlatformVersion(qualifiers);
if (versionQualifierApiLevel == -1) {
if (qualifiers.length() > 0) {
qualifiers += "-";
}
qualifiers += "v" + apiLevel;
}
return qualifiers;
}
代码示例来源:origin: org.robolectric/shadows-framework
public static void applyQualifiers(String qualifiersStrs, int apiLevel,
Configuration configuration, DisplayMetrics displayMetrics) {
String[] qualifiersParts = qualifiersStrs.split(" ", 0);
int i = qualifiersParts.length - 1;
// find the index of the left-most qualifier string that doesn't start with '+'
for (; i >= 0 ; i--) {
String qualifiersStr = qualifiersParts[i];
if (qualifiersStr.startsWith("+")) {
qualifiersParts[i] = qualifiersStr.substring(1);
} else {
break;
}
}
for (i = (i < 0) ? 0 : i; i < qualifiersParts.length ; i++) {
String qualifiersStr = qualifiersParts[i];
int platformVersion = Qualifiers.getPlatformVersion(qualifiersStr);
if (platformVersion != -1 && platformVersion != apiLevel) {
throw new IllegalArgumentException(
"Cannot specify conflicting platform version in qualifiers: \"" + qualifiersStr + "\"");
}
Qualifiers qualifiers = Qualifiers.parse(qualifiersStr);
DeviceConfig.applyToConfiguration(qualifiers, apiLevel, configuration, displayMetrics);
}
DeviceConfig.applyRules(configuration, displayMetrics, apiLevel);
fixJellyBean(configuration, displayMetrics);
}
内容来源于网络,如有侵权,请联系作者删除!