org.robolectric.annotation.Implementation.minSdk()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.robolectric.annotation.Implementation.minSdk()方法的一些代码示例,展示了Implementation.minSdk()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Implementation.minSdk()方法的具体详情如下:
包路径:org.robolectric.annotation.Implementation
类名称:Implementation
方法名:minSdk

Implementation.minSdk介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

private boolean matchesSdk(Implementation implementation) {
 return implementation.minSdk() <= apiLevel && (implementation.maxSdk() == -1 || implementation.maxSdk() >= apiLevel);
}

代码示例来源:origin: robolectric/robolectric

List<Sdk> sdksMatching(Implementation implementation, int classMinSdk, int classMaxSdk) {
 loadSdksOnce();
 int minSdk = implementation == null ? DEFAULT_SDK : implementation.minSdk();
 if (minSdk == DEFAULT_SDK) {
  minSdk = 0;
 }
 if (classMinSdk > minSdk) {
  minSdk = classMinSdk;
 }
 int maxSdk = implementation == null ? -1 : implementation.maxSdk();
 if (maxSdk == -1) {
  maxSdk = Integer.MAX_VALUE;
 }
 if (classMaxSdk != -1 && classMaxSdk < maxSdk) {
  maxSdk = classMaxSdk;
 }
 List<Sdk> matchingSdks = new ArrayList<>();
 for (Sdk sdk : sdks) {
  Integer sdkInt = sdk.sdkInt;
  if (sdkInt >= minSdk && sdkInt <= maxSdk) {
   matchingSdks.add(sdk);
  }
 }
 return matchingSdks;
}

代码示例来源:origin: robolectric/robolectric

documentedMethod.minSdk = sdkOrNull(implementation.minSdk());
documentedMethod.maxSdk = sdkOrNull(implementation.maxSdk());

代码示例来源:origin: robolectric/robolectric

private static boolean shouldCallDirectlyOnFramework(TreePath idPath) {
 if (idPath.getParentPath().getLeaf().getKind() == Kind.MEMBER_SELECT) {
  Tree maybeMethodInvocation = idPath.getParentPath().getParentPath().getLeaf();
  if (maybeMethodInvocation.getKind() == Kind.METHOD_INVOCATION) {
   MethodInvocationTree methodInvocation = (MethodInvocationTree) maybeMethodInvocation;
   MethodSymbol methodSym = getSymbol(methodInvocation);
   if (methodSym == null) {
    return false;
   }
   Implementation implAnnotation = methodSym.getAnnotation(Implementation.class);
   if (implAnnotation != null) {
    int minSdk = implAnnotation.minSdk();
    int maxSdk = implAnnotation.maxSdk();
    // if minSdk or maxSdk is set (or the method is marked @HiddenApi), this method might
    // not be available at every SDK level (or at all).
    return (minSdk == Implementation.DEFAULT_SDK || minSdk <= 16)
      && maxSdk == Implementation.DEFAULT_SDK
      && methodSym.getAnnotation(HiddenApi.class) == null;
   }
  }
 }
 return false;
}

代码示例来源:origin: org.robolectric/robolectric-sandbox

private boolean matchesSdk(Implementation implementation) {
 return implementation.minSdk() <= apiLevel && (implementation.maxSdk() == -1 || implementation.maxSdk() >= apiLevel);
}

相关文章