Skip to content
Browse files

drag doesn't work for old Android versions

- Version 4.5.3
- Fixed for API > 15
  • Loading branch information...
1 parent 818c4b5 commit 6cd170e65a8869fd9d5915a984342aa3b8937ce7 @dtmilano committed Oct 4, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py
View
10 AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py
@@ -17,7 +17,7 @@
@author: Diego Torres Milano
'''
-__version__ = '4.5.1'
+__version__ = '4.5.3'
import sys
import warnings
@@ -368,7 +368,13 @@ def touch(self, x, y, eventType=DOWN_AND_UP):
self.shell('input tap %d %d' % (x, y))
def drag(self, (x0, y0), (x1, y1), duration, steps):
- self.shell('input swipe %d %d %d %d %d' % (x0, y0, x1, y1, duration*1000))
+ version = int(self.getProperty('ro.build.version.sdk'))
+ if version <= 15:
+ raise RuntimeError('drag: API <= 15 not supported (version=%d)' % version)
+ elif version <= 17:
+ self.shell('input swipe %d %d %d %d' % (x0, y0, x1, y1))
+ else:
+ self.shell('input swipe %d %d %d %d %d' % (x0, y0, x1, y1, duration*1000))
def type(self, text):
self.shell(u'input text "%s"' % text)

0 comments on commit 6cd170e

Please sign in to comment.
Something went wrong with that request. Please try again.