blob: 70948566a2e04670910c738673c6d91c0a0868c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package org.robolectric.shadows;
import static android.os.Build.VERSION_CODES.KITKAT;
import android.view.InputDevice;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadow.api.Shadow;
@Implements(InputDevice.class)
public class ShadowInputDevice {
private String deviceName;
private int productId;
private int vendorId;
public static InputDevice makeInputDeviceNamed(String deviceName) {
InputDevice inputDevice = Shadow.newInstanceOf(InputDevice.class);
ShadowInputDevice shadowInputDevice = Shadow.extract(inputDevice);
shadowInputDevice.setDeviceName(deviceName);
return inputDevice;
}
@Implementation
protected String getName() {
return deviceName;
}
@Implementation(minSdk = KITKAT)
protected int getProductId() {
return productId;
}
@Implementation(minSdk = KITKAT)
protected int getVendorId() {
return vendorId;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setProductId(int productId) {
this.productId = productId;
}
public void setVendorId(int vendorId) {
this.vendorId = vendorId;
}
}
|