aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Jin <kjin@google.com>2014-03-31 15:37:59 -0700
committerKevin Jin <kjin@google.com>2014-03-31 15:37:59 -0700
commitd9ecc536e454bd4c23d6e0bbf5af1328e34b1748 (patch)
tree58b93e4c11e34d2792b74b057c4c74af749018af /src
parentdf66b27599d3679de93f14ef972a32100d231683 (diff)
downloaddroiddriver-d9ecc536e454bd4c23d6e0bbf5af1328e34b1748.tar.gz
move ProgressBarScrollStepStrategy to Scrollers
Change-Id: I928c86024f8f498dde46298804969998eeb56ba2
Diffstat (limited to 'src')
-rw-r--r--src/com/google/android/droiddriver/scroll/ForwardingScrollStepStrategy.java27
-rw-r--r--src/com/google/android/droiddriver/scroll/Scrollers.java32
2 files changed, 31 insertions, 28 deletions
diff --git a/src/com/google/android/droiddriver/scroll/ForwardingScrollStepStrategy.java b/src/com/google/android/droiddriver/scroll/ForwardingScrollStepStrategy.java
index 7c849a5..f4cfd17 100644
--- a/src/com/google/android/droiddriver/scroll/ForwardingScrollStepStrategy.java
+++ b/src/com/google/android/droiddriver/scroll/ForwardingScrollStepStrategy.java
@@ -15,11 +15,9 @@
*/
package com.google.android.droiddriver.scroll;
-import android.widget.ProgressBar;
import com.google.android.droiddriver.DroidDriver;
import com.google.android.droiddriver.UiElement;
-import com.google.android.droiddriver.finders.By;
import com.google.android.droiddriver.finders.Finder;
import com.google.android.droiddriver.scroll.Direction.DirectionConverter;
import com.google.android.droiddriver.scroll.Direction.PhysicalDirection;
@@ -68,29 +66,4 @@ public abstract class ForwardingScrollStepStrategy implements ScrollStepStrategy
public String toString() {
return delegate().toString();
}
-
- /**
- * Augments the delegate {@link ScrollStepStrategy) - after a successful
- * scroll, waits until ProgressBar is gone.
- */
- public static abstract class ProgressBarScrollStepStrategy extends ForwardingScrollStepStrategy {
- @Override
- public boolean scroll(DroidDriver driver, Finder containerFinder, PhysicalDirection direction) {
- if (super.scroll(driver, containerFinder, direction)) {
- driver.checkGone(By.className(ProgressBar.class));
- return true;
- }
- return false;
- }
-
- /** Convenience method to wrap {@code delegate} with this class */
- public static ScrollStepStrategy wrap(final ScrollStepStrategy delegate) {
- return new ProgressBarScrollStepStrategy() {
- @Override
- protected ScrollStepStrategy delegate() {
- return delegate;
- }
- };
- }
- }
}
diff --git a/src/com/google/android/droiddriver/scroll/Scrollers.java b/src/com/google/android/droiddriver/scroll/Scrollers.java
index 9834c71..3459f0e 100644
--- a/src/com/google/android/droiddriver/scroll/Scrollers.java
+++ b/src/com/google/android/droiddriver/scroll/Scrollers.java
@@ -17,15 +17,45 @@
package com.google.android.droiddriver.scroll;
import android.app.UiAutomation;
+import android.widget.ProgressBar;
+import com.google.android.droiddriver.DroidDriver;
+import com.google.android.droiddriver.finders.By;
+import com.google.android.droiddriver.finders.Finder;
import com.google.android.droiddriver.scroll.Direction.Axis;
import com.google.android.droiddriver.scroll.Direction.DirectionConverter;
+import com.google.android.droiddriver.scroll.Direction.PhysicalDirection;
/**
- * Static utility methods pertaining to {@link Scroller} instances.
+ * Static utility classes and methods pertaining to {@link Scroller} instances.
*/
public class Scrollers {
/**
+ * Augments the delegate {@link ScrollStepStrategy) - after a successful
+ * scroll, waits until ProgressBar is gone.
+ */
+ public static abstract class ProgressBarScrollStepStrategy extends ForwardingScrollStepStrategy {
+ @Override
+ public boolean scroll(DroidDriver driver, Finder containerFinder, PhysicalDirection direction) {
+ if (super.scroll(driver, containerFinder, direction)) {
+ driver.checkGone(By.className(ProgressBar.class));
+ return true;
+ }
+ return false;
+ }
+
+ /** Convenience method to wrap {@code delegate} with this class */
+ public static ScrollStepStrategy wrap(final ScrollStepStrategy delegate) {
+ return new ProgressBarScrollStepStrategy() {
+ @Override
+ protected ScrollStepStrategy delegate() {
+ return delegate;
+ }
+ };
+ }
+ }
+
+ /**
* Returns a new default Scroller that works in simple cases. In complex cases
* you may try a {@link StepBasedScroller} with a custom
* {@link ScrollStepStrategy}: