Search in sources :

Example 56 with Implementation

use of org.robolectric.annotation.Implementation in project scdl by passy.

the class ShadowMessage method obtain.

@Implementation
public static Message obtain(Handler h, int what, int arg1, int arg2) {
    Message m = obtain(h, what);
    m.arg1 = arg1;
    m.arg2 = arg2;
    return m;
}
Also used : Message(android.os.Message) Implementation(org.robolectric.annotation.Implementation)

Example 57 with Implementation

use of org.robolectric.annotation.Implementation in project scdl by passy.

the class ShadowMessage method obtain.

@Implementation
public static Message obtain(Handler h, int what, int arg1, int arg2, Object obj) {
    Message m = obtain(h, what, arg1, arg2);
    m.obj = obj;
    return m;
}
Also used : Message(android.os.Message) Implementation(org.robolectric.annotation.Implementation)

Example 58 with Implementation

use of org.robolectric.annotation.Implementation in project fresco by facebook.

the class MyShadowBitmap method createBitmap.

@Implementation
public static Bitmap createBitmap(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];
    return bitmap;
}
Also used : Bitmap(android.graphics.Bitmap) Implementation(org.robolectric.annotation.Implementation)

Example 59 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowRemoteCallbackList method register.

@Implementation
public boolean register(E callback, Object cookie) {
    synchronized (callbacks) {
        if (killed) {
            return false;
        }
        IBinder binder = callback.asBinder();
        try {
            Callback cb = new Callback(callback, cookie);
            binder.linkToDeath(cb, 0);
            callbacks.put(binder, cb);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }
}
Also used : IBinder(android.os.IBinder) RemoteException(android.os.RemoteException) Implementation(org.robolectric.annotation.Implementation)

Example 60 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowResources method getDisplayMetrics.

@Implementation
public DisplayMetrics getDisplayMetrics() {
    if (displayMetrics == null) {
        if (display == null) {
            display = ReflectionHelpers.callConstructor(Display.class);
        }
        displayMetrics = new DisplayMetrics();
        display.getMetrics(displayMetrics);
    }
    displayMetrics.density = this.density;
    return displayMetrics;
}
Also used : DisplayMetrics(android.util.DisplayMetrics) Display(android.view.Display) Implementation(org.robolectric.annotation.Implementation)

Aggregations

Implementation (org.robolectric.annotation.Implementation)114 Bitmap (android.graphics.Bitmap)17 HiddenApi (org.robolectric.annotation.HiddenApi)10 BitmapDrawable (android.graphics.drawable.BitmapDrawable)6 View (android.view.View)6 IOException (java.io.IOException)6 ContentProvider (android.content.ContentProvider)5 IContentProvider (android.content.IContentProvider)5 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)5 Rect (android.graphics.Rect)4 Message (android.os.Message)4 RealObject (org.robolectric.annotation.RealObject)4 FileTypedResource (org.robolectric.res.FileTypedResource)4 Point (android.graphics.Point)3 AccessibilityWindowInfo (android.view.accessibility.AccessibilityWindowInfo)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 LinkedList (java.util.LinkedList)3 Activity (android.app.Activity)2 Dialog (android.app.Dialog)2