Search in sources :

Example 51 with Implementation

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

the class ShadowAccessibilityManager method getInstance.

@HiddenApi
@Implementation
public static AccessibilityManager getInstance(Context context) throws Exception {
    if (getApiLevel() >= KITKAT) {
        AccessibilityManager accessibilityManager = Shadow.newInstance(AccessibilityManager.class, new Class[] { Context.class, IAccessibilityManager.class, int.class }, new Object[] { context, new AccessibilityManagerService(context), 0 });
        ReflectionHelpers.setField(accessibilityManager, "mHandler", new MyHandler(context.getMainLooper(), accessibilityManager));
        return accessibilityManager;
    } else {
        AccessibilityManager accessibilityManager = Shadow.newInstance(AccessibilityManager.class, new Class[0], new Object[0]);
        ReflectionHelpers.setField(accessibilityManager, "mHandler", new MyHandler(context.getMainLooper(), accessibilityManager));
        return accessibilityManager;
    }
}
Also used : AccessibilityManagerService(com.android.server.accessibility.AccessibilityManagerService) AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 52 with Implementation

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

the class ShadowAccessibilityNodeInfo method obtain.

@Implementation
public static AccessibilityNodeInfo obtain(AccessibilityNodeInfo info) {
    final ShadowAccessibilityNodeInfo shadowInfo = ((ShadowAccessibilityNodeInfo) ShadowExtractor.extract(info));
    final AccessibilityNodeInfo obtainedInstance = shadowInfo.getClone();
    sAllocationCount++;
    StrictEqualityNodeWrapper wrapper = new StrictEqualityNodeWrapper(obtainedInstance);
    obtainedInstances.put(wrapper, Thread.currentThread().getStackTrace());
    orderedInstances.put(sAllocationCount, wrapper);
    return obtainedInstance;
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) Implementation(org.robolectric.annotation.Implementation)

Example 53 with Implementation

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

the class ShadowAccessibilityNodeInfo method addChild.

@Implementation
public void addChild(View root, int virtualDescendantId) {
    AccessibilityNodeInfo node = AccessibilityNodeInfo.obtain(root, virtualDescendantId);
    addChild(node);
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) Implementation(org.robolectric.annotation.Implementation)

Example 54 with Implementation

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

the class ShadowAccessibilityNodeInfo method removeAction.

@Implementation(minSdk = LOLLIPOP)
public void removeAction(int action) {
    AccessibilityAction convertedAction = getActionFromIdFromFrameWork(action);
    removeAction(convertedAction);
}
Also used : AccessibilityAction(android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction) Implementation(org.robolectric.annotation.Implementation)

Example 55 with Implementation

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

the class ShadowAnimationUtils method loadLayoutAnimation.

@Implementation
public static LayoutAnimationController loadLayoutAnimation(Context context, int id) {
    Animation anim = new TranslateAnimation(0, 0, 30, 0);
    LayoutAnimationController layoutAnim = new LayoutAnimationController(anim);
    Shadows.shadowOf(layoutAnim).setLoadedFromResourceId(id);
    return layoutAnim;
}
Also used : LayoutAnimationController(android.view.animation.LayoutAnimationController) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) 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