org.robolectric.shadows.ShadowInputManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shadows-framework Show documentation
Show all versions of shadows-framework Show documentation
An alternative Android testing framework.
package org.robolectric.shadows;
import static android.os.Build.VERSION_CODES.KITKAT;
import android.hardware.input.InputManager;
import android.view.InputEvent;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.Resetter;
import org.robolectric.util.ReflectionHelpers;
@Implements(value = InputManager.class)
public class ShadowInputManager {
@Implementation
protected boolean injectInputEvent(InputEvent event, int mode) {
// ignore
return true;
}
@Implementation(minSdk = KITKAT)
protected boolean[] deviceHasKeys(int id, int[] keyCodes) {
return new boolean[keyCodes.length];
}
@Resetter
public static void reset() {
ReflectionHelpers.setStaticField(InputManager.class, "sInstance", null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy