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;
}
}
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;
}
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);
}
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);
}
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;
}
Aggregations