Skip to content

Commit 54af0cc

Browse files
committed
moved sendKeyEvent() out of AppiumDriver, into AndroidDriver, since it's Android only
1 parent f05897d commit 54af0cc

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

src/main/java/io/appium/java_client/AppiumDriver.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,6 @@ public void runAppInBackground(int seconds) {
249249
execute(RUN_APP_IN_BACKGROUND, ImmutableMap.of("seconds", seconds));
250250
}
251251

252-
/**
253-
* Send a key event to the device
254-
*
255-
* @param key
256-
* code for the key pressed on the device
257-
*/
258-
@Override
259-
public void sendKeyEvent(int key) {
260-
execute(KEY_EVENT, getCommandImmutableMap(KEY_CODE, key));
261-
}
262-
263252
/**
264253
* @see DeviceActionShortcuts#hideKeyboard()
265254
*/

src/main/java/io/appium/java_client/DeviceActionShortcuts.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,4 @@ public interface DeviceActionShortcuts {
1010
*/
1111
public void hideKeyboard();
1212

13-
/**
14-
* Send a key event to the device
15-
*
16-
* @param key code for the key pressed on the device
17-
*
18-
* @see io.appium.java_client.android.AndroidKeyCode
19-
* @see io.appium.java_client.ios.IOSKeyCode
20-
*/
21-
public void sendKeyEvent(int key);
22-
2313
}

src/main/java/io/appium/java_client/android/AndroidDeviceActionShortcuts.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
import io.appium.java_client.DeviceActionShortcuts;
44

55
public interface AndroidDeviceActionShortcuts extends DeviceActionShortcuts {
6+
7+
/**
8+
* Send a key event to the device
9+
*
10+
* @param key
11+
* code for the key pressed on the device
12+
*/
13+
public void sendKeyEvent(int key);
14+
615
/**
716
* Send a key event along with an Android metastate to an Android device
817
* Metastates are things like *shift* to get uppercase characters

src/main/java/io/appium/java_client/android/AndroidDriver.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ static String UiScrollable(String uiSelector) {
6969
return "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(" + uiSelector + ".instance(0));";
7070
}
7171

72+
/**
73+
* Send a key event to the device
74+
*
75+
* @param key
76+
* code for the key pressed on the device
77+
*/
78+
@Override
79+
public void sendKeyEvent(int key) {
80+
execute(KEY_EVENT, getCommandImmutableMap(KEY_CODE, key));
81+
}
82+
7283
/**
7384
* @param key
7485
* code for the key pressed on the Android device

0 commit comments

Comments
 (0)