Search in sources :

Example 46 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 47 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 48 with Implementation

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

the class ShadowAbsSpinner method setSelection.

@Implementation
public void setSelection(int position) {
    directlyOn(realAbsSpinner, AbsSpinner.class, "setSelection", ClassParameter.from(int.class, position));
    SpinnerAdapter adapter = realAbsSpinner.getAdapter();
    if (getItemSelectedListener() != null && adapter != null) {
        getItemSelectedListener().onItemSelected(realAbsSpinner, null, position, adapter.getItemId(position));
    }
}
Also used : SpinnerAdapter(android.widget.SpinnerAdapter) Implementation(org.robolectric.annotation.Implementation)

Example 49 with Implementation

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

the class ShadowAccessibilityEvent method obtain.

@Implementation
public static AccessibilityEvent obtain(AccessibilityEvent event) {
    ShadowAccessibilityEvent shadowEvent = ((ShadowAccessibilityEvent) ShadowExtractor.extract(event));
    AccessibilityEvent obtainedInstance = shadowEvent.getClone();
    sAllocationCount++;
    StrictEqualityEventWrapper wrapper = new StrictEqualityEventWrapper(obtainedInstance);
    obtainedInstances.put(wrapper, Thread.currentThread().getStackTrace());
    orderedInstances.put(sAllocationCount, wrapper);
    return obtainedInstance;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent) Implementation(org.robolectric.annotation.Implementation)

Example 50 with Implementation

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

the class ShadowAccessibilityEvent method obtain.

@Implementation
public static AccessibilityEvent obtain(int eventType) {
    // We explicitly avoid allocating the AccessibilityEvent from the actual pool by using
    // the private constructor. Not doing so affects test suites which use both shadow and
    // non-shadow objects.
    final AccessibilityEvent obtainedInstance = ReflectionHelpers.callConstructor(AccessibilityEvent.class);
    final ShadowAccessibilityEvent shadowObtained = ((ShadowAccessibilityEvent) ShadowExtractor.extract(obtainedInstance));
    sAllocationCount++;
    StrictEqualityEventWrapper wrapper = new StrictEqualityEventWrapper(obtainedInstance);
    obtainedInstances.put(wrapper, Thread.currentThread().getStackTrace());
    orderedInstances.put(sAllocationCount, wrapper);
    shadowObtained.eventType = eventType;
    return obtainedInstance;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent) 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