Search in sources :

Example 41 with Implementation

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

the class ShadowBitmapFactory method decodeByteArray.

@Implementation
public static Bitmap decodeByteArray(byte[] data, int offset, int length, BitmapFactory.Options opts) {
    String desc = new String(data);
    if (!Charset.forName("US-ASCII").newEncoder().canEncode(desc)) {
        Checksum checksumEngine = new CRC32();
        checksumEngine.update(data, 0, data.length);
        desc = "byte array, checksum: " + checksumEngine.getValue();
    }
    if (offset != 0 || length != data.length) {
        desc += " bytes " + offset + ".." + length;
    }
    return create(desc, opts);
}
Also used : CRC32(java.util.zip.CRC32) Checksum(java.util.zip.Checksum) Implementation(org.robolectric.annotation.Implementation)

Example 42 with Implementation

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

the class ShadowBitmapFactory method decodeByteArray.

@Implementation
public static Bitmap decodeByteArray(byte[] data, int offset, int length) {
    Bitmap bitmap = decodeByteArray(data, offset, length, new BitmapFactory.Options());
    ShadowBitmap shadowBitmap = Shadows.shadowOf(bitmap);
    shadowBitmap.createdFromBytes = data;
    return bitmap;
}
Also used : Bitmap(android.graphics.Bitmap) BitmapFactory(android.graphics.BitmapFactory) Implementation(org.robolectric.annotation.Implementation)

Example 43 with Implementation

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

the class ShadowPreferenceFragmentCompat method onCreateView.

@Implementation
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    RecyclerView recyclerView = new RecyclerView(container.getContext());
    recyclerView.setId(R.id.list);
    ReflectionHelpers.setField(realObject, "mList", recyclerView);
    return recyclerView;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) Implementation(org.robolectric.annotation.Implementation)

Example 44 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) {
    Message m = new Message();
    m.setTarget(h);
    return m;
}
Also used : Message(android.os.Message) Implementation(org.robolectric.annotation.Implementation)

Example 45 with Implementation

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

the class ShadowMessage method obtain.

@Implementation
public static Message obtain(Message msg) {
    Message m = new Message();
    m.copyFrom(msg);
    m.setTarget(msg.getTarget());
    return m;
}
Also used : Message(android.os.Message) 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