diff --git a/robotium-solo/src/main/java/com/robotium/solo/Clicker.java b/robotium-solo/src/main/java/com/robotium/solo/Clicker.java index a15625a7..f81b4626 100644 --- a/robotium-solo/src/main/java/com/robotium/solo/Clicker.java +++ b/robotium-solo/src/main/java/com/robotium/solo/Clicker.java @@ -37,7 +37,7 @@ class Clicker { private final Waiter waiter; private final WebUtils webUtils; private final DialogUtils dialogUtils; - private final int MINI_WAIT = 200; + private final int MINI_WAIT = 300; private final int WAIT_TIME = 1500; @@ -78,7 +78,7 @@ public void clickOnScreen(float x, float y, View view) { int retry = 0; SecurityException ex = null; - while(!successfull && retry < 10) { + while(!successfull && retry < 20) { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, @@ -123,7 +123,7 @@ public void clickLongOnScreen(float x, float y, int time, View view) { long eventTime = SystemClock.uptimeMillis(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); - while(!successfull && retry < 10) { + while(!successfull && retry < 20) { try{ inst.sendPointerSync(event); successfull = true; @@ -213,7 +213,7 @@ public void clickOnScreen(View view, boolean longClick, int time) { */ private float[] getClickCoordinates(View view){ - sleeper.sleep(MINI_WAIT); + sleeper.sleep(200); int[] xyLocation = new int[2]; float[] xyToClick = new float[2]; diff --git a/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java b/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java index 50a8ca05..cf4ef2ba 100644 --- a/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java +++ b/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java @@ -399,6 +399,7 @@ public View getIdenticalView(View view) { break; } } + return viewToReturn; } @@ -412,66 +413,19 @@ public View getIdenticalView(View view) { */ private boolean areViewsIdentical(View firstView, View secondView){ - if(firstView.getId() != secondView.getId() || !firstView.getClass().isAssignableFrom(secondView.getClass())){ return false; } - if(!isSamePlacementInRespectiveTree(firstView, secondView)){ - return false; - } - if (firstView.getParent() != null && firstView.getParent() instanceof View && secondView.getParent() != null && secondView.getParent() instanceof View) { - + return areViewsIdentical((View) firstView.getParent(), (View) secondView.getParent()); } else { return true; } } - /** - * Compares if two views have the same placement in their respective trees. - * - * @param firstView the first view to compare - * @param secondView the second view to compare - * @return true if equal placement and false if not - */ - - private boolean isSamePlacementInRespectiveTree(View firstView, View secondView){ - - if(getObjectPlacementNumber(firstView) == getObjectPlacementNumber(secondView)){ - return true; - } - return false; - } - - /** - * Returns the placement number of the specified view relative to its parent. - * - * @param view the view to check placement number - * @return the object placement number of the specified view - */ - - private int getObjectPlacementNumber(View view){ - final ArrayList allViewsFirst = new ArrayList(); - int numberOrder = 0; - try{ - ViewParent parent = view.getParent(); - if(parent instanceof ViewGroup){ - addChildren(allViewsFirst, (ViewGroup) parent, true); - } - - for(View v : allViewsFirst){ - numberOrder++; - if(v.equals(view)){ - break; - } - } - }catch(Exception ignored){} - return numberOrder; - } - private static Class windowManager; static{ try { diff --git a/robotium-solo/src/main/java/com/robotium/solo/Waiter.java b/robotium-solo/src/main/java/com/robotium/solo/Waiter.java index 46ba2d09..20699633 100644 --- a/robotium-solo/src/main/java/com/robotium/solo/Waiter.java +++ b/robotium-solo/src/main/java/com/robotium/solo/Waiter.java @@ -30,7 +30,7 @@ class Waiter { private final Searcher searcher; private final Scroller scroller; private final Sleeper sleeper; - private final int MINISLEEP = 15; + private final int MINISLEEP = 10; /**