diff --git a/android_pyapi/android/graphics.py b/android_pyapi/android/graphics.py index 26b866a..9ef733e 100644 --- a/android_pyapi/android/graphics.py +++ b/android_pyapi/android/graphics.py @@ -258,14 +258,17 @@ class Rect(Stub): self.right -= dx self.bottom -= dy - def contains(self, x: int, y: int) -> bool: - return self.left < self.right and self.top < self.bottom \ - and x >= self.left and x < self.right and y >= self.top and y < self.bottom - - def contains(self, left: int, top: int, right: int, bottom: int) -> bool: - return self.left < self.right and self.top < self.bottom \ - and self.left <= left and self.top <= top \ - and self.right >= right and self.bottom >= bottom + def contains(self, *args) -> bool: + if len(args) == 2: + x, y = args + return (self.left < self.right and self.top < self.bottom + and x >= self.left and x < self.right and y >= self.top and y < self.bottom) + elif len(args) == 4: + left, top, right, bottom = args + return (self.left < self.right and self.top < self.bottom + and self.left <= left and self.top <= top + and self.right >= right and self.bottom >= bottom) + return False def intersect(self, left: int, top: int, right: int, bottom: int) -> bool: nL = max(self.left, left)