当前位置: 首页>>代码示例>>Java>>正文


Java Implementation类代码示例

本文整理汇总了Java中org.robolectric.annotation.Implementation的典型用法代码示例。如果您正苦于以下问题:Java Implementation类的具体用法?Java Implementation怎么用?Java Implementation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Implementation类属于org.robolectric.annotation包,在下文中一共展示了Implementation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: elapsedRealtime

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@SuppressWarnings("unused")
@Implementation
public static long elapsedRealtime() {
  // The default is to return something using the main looper, which doesn't exist on
  // Volley's threads.
  return System.currentTimeMillis();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:VolleyStreamFetcherServerTest.java

示例2: getFrameAtTime

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
@SuppressWarnings("unused")
public Bitmap getFrameAtTime() {
  Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
  Shadows.shadowOf(bitmap).appendDescription(" from MediaMetadataRetriever");
  return bitmap;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:GlideTest.java

示例3: make

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public static Snackbar make(@NonNull View view, @NonNull CharSequence text, int duration) {
    Snackbar snackbar = null;

    try {
        Constructor<Snackbar> constructor = Snackbar.class.getDeclaredConstructor(ViewGroup.class);

        //just in case, maybe they'll change the method signature in the future
        if (null == constructor)
            throw new IllegalArgumentException("Seems like the constructor was not found!");


        if (Modifier.isPrivate(constructor.getModifiers())) {
            constructor.setAccessible(true);
        }

        snackbar = constructor.newInstance(findSuitableParent(view));
        snackbar.setText(text);
        snackbar.setDuration(duration);
    } catch (Exception e) {
        e.printStackTrace();
    }

    shadowOf(snackbar).text = text.toString();

    shadowSnackbars.add(shadowOf(snackbar));

    return snackbar;
}
 
开发者ID:mirhoseini,项目名称:bcg,代码行数:30,代码来源:ShadowSnackbar.java

示例4: openInputStream

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public InputStream openInputStream(Uri uri) {
  if (!URI_TO_INPUT_STREAMS.containsKey(uri)) {
    throw new IllegalArgumentException(
        "You must first register an InputStream for uri: " + uri);
  }
  return URI_TO_INPUT_STREAMS.get(uri);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:GlideTest.java

示例5: openAssetFileDescriptor

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public AssetFileDescriptor openAssetFileDescriptor(Uri uri, String type) {
  if (!URI_TO_FILE_DESCRIPTOR.containsKey(uri)) {
    throw new IllegalArgumentException(
        "You must first register an AssetFileDescriptor for " + "uri: " + uri);
  }
  return URI_TO_FILE_DESCRIPTOR.get(uri);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:GlideTest.java

示例6: equals

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Override @Implementation
public boolean equals(Object object) {
    if (object == null) return false;
    if (this == object) return true;
    if (object.getClass() != PointF.class) return false;

    PointF that = (PointF) object;
    if (this.realPointF.x == that.x && this.realPointF.y == that.y) return true;

    return false;
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:12,代码来源:ShadowPointF.java

示例7: createBitmap

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public static Bitmap createBitmap(int width, int height, Bitmap.Config config) {
  // Robolectric doesn't match the framework behavior with null configs, so we have to do so
  // here.
  Preconditions.checkNotNull("Config must not be null");
  return ShadowBitmap.createBitmap(width, height, config);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:TransformationUtilsTest.java

示例8: createBitmap

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public static Bitmap createBitmap(int colors[], int width, int height, Bitmap.Config config) {
  Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class);
  MyShadowBitmap shadowBitmap = (MyShadowBitmap) ShadowExtractor.extract(bitmap);
  shadowBitmap.width = width;
  shadowBitmap.height = height;
  shadowBitmap.mPixels = new int[width * height];
  for (int i = 0; i < colors.length; i++) {
    shadowBitmap.mPixels[i] = colors[i];
  }
  return bitmap;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:MyShadowBitmap.java

示例9: registerNetworkCallback

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation(minSdk = LOLLIPOP)
@RequiresApi(LOLLIPOP)
public void registerNetworkCallback(NetworkRequest request, NetworkCallback networkCallback) {
  networkCallbacks.add(networkCallback);
  // simulate available connection
  networkCallback.onAvailable(getActiveNetwork());
}
 
开发者ID:greyfoxit,项目名称:RxNetwork,代码行数:8,代码来源:ShadowConnectivityManagerWithCallback.java

示例10: get

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
@SuppressWarnings("unused")
public static String get(String key) {
    if ("ro.product.cpu.abilist".equals(key)) {
        return "armeabi";
    }
    return ShadowSystemProperties.get(key);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:9,代码来源:ProperMultiRepoUpdaterTest.java

示例11: getSystemService

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Override
@Implementation
public Object getSystemService(String name) {
    if ("appops".equals(name)) {
        return null;
    }

    return super.getSystemService(name);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:10,代码来源:ShadowContextImpl.java

示例12: isLoggable

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public static synchronized boolean isLoggable(String tag, int level) {
    if ((TextUtils.equals(tag, "CursorWindowStats") && level <= Log.INFO)
            || (TextUtils.equals(tag, "SQLiteCursor") && level <= Log.DEBUG)) {
        return false;
    }

    return org.robolectric.shadows.ShadowLog.isLoggable(tag, level);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:10,代码来源:ShadowLog.java

示例13: executeOnExecutor

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public AsyncTask<Void, Integer, Intent> executeOnExecutor(Executor executor, Void... params) {
    return super.execute(params);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:5,代码来源:ShadowOpenPgpAsyncTask.java

示例14: toString

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Override @Implementation
public String toString() {
    return "Point(" + realPointF.x + ", " + realPointF.y + ")";
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:5,代码来源:ShadowPointF.java

示例15: endMethod

import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation public static void endMethod(int trackingId) {
  mockTracker.endMethod(trackingId);
}
 
开发者ID:rakutentech,项目名称:android-perftracking,代码行数:4,代码来源:TrackerShadow.java


注:本文中的org.robolectric.annotation.Implementation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。