Skip to content

Commit

Permalink
drag doesn't work for old Android versions
Browse files Browse the repository at this point in the history
- Version 4.5.3
- Fixed for API > 15
  • Loading branch information
dtmilano committed Oct 5, 2013
1 parent 818c4b5 commit 6cd170e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@author: Diego Torres Milano
'''

__version__ = '4.5.1'
__version__ = '4.5.3'

import sys
import warnings
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6cd170e

Please sign in to comment.