本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例13: executeOnExecutor
import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation
public AsyncTask<Void, Integer, Intent> executeOnExecutor(Executor executor, Void... params) {
return super.execute(params);
}
示例14: toString
import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Override @Implementation
public String toString() {
return "Point(" + realPointF.x + ", " + realPointF.y + ")";
}
示例15: endMethod
import org.robolectric.annotation.Implementation; //导入依赖的package包/类
@Implementation public static void endMethod(int trackingId) {
mockTracker.endMethod(trackingId);
}