public class AccessibilityEventScrollStepStrategy extends java.lang.Object implements ScrollStepStrategy
ScrollStepStrategy
that determines whether more scrolling is
possible by checking the AccessibilityEvent
returned by
UiAutomation
.
This implementation behaves just like the UiScrollable class. It may not work in all cases. For instance,
sometimes android.support.v4.widget.DrawerLayout
does not send
correct AccessibilityEvent
s after scrolling.
Modifier and Type | Class and Description |
---|---|
static class |
AccessibilityEventScrollStepStrategy.NullAccessibilityEventScrollStepStrategy
Some widgets may not always fire correct
AccessibilityEvent . |
Constructor and Description |
---|
AccessibilityEventScrollStepStrategy(android.app.UiAutomation uiAutomation,
long scrollEventTimeoutMillis,
Direction.DirectionConverter converter) |
Modifier and Type | Method and Description |
---|---|
void |
beginScrolling(DroidDriver driver,
Finder containerFinder,
Finder itemFinder,
Direction.PhysicalDirection direction)
Called only if this step is at the beginning of a series of scroll steps with regard to the
given arguments.
|
protected boolean |
detectEnd(android.view.accessibility.AccessibilityEvent event,
Direction.Axis axis) |
void |
doScroll(UiElement container,
Direction.PhysicalDirection direction)
Performs the scroll action on
container . |
protected android.view.accessibility.AccessibilityEvent |
doScrollAndReturnEvent(UiElement container,
Direction.PhysicalDirection direction) |
void |
endScrolling(DroidDriver driver,
Finder containerFinder,
Finder itemFinder,
Direction.PhysicalDirection direction)
Called only if this step is at the end of a series of scroll steps with regard to the given
arguments.
|
Direction.DirectionConverter |
getDirectionConverter()
Returns the
Direction.DirectionConverter . |
boolean |
scroll(DroidDriver driver,
Finder containerFinder,
Direction.PhysicalDirection direction)
Tries to scroll
containerFinder in direction . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
public AccessibilityEventScrollStepStrategy(android.app.UiAutomation uiAutomation, long scrollEventTimeoutMillis, Direction.DirectionConverter converter)
public boolean scroll(DroidDriver driver, Finder containerFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
containerFinder
in direction
. Returns whether scrolling is
effective.scroll
in interface ScrollStepStrategy
driver
- a DroidDriver instancecontainerFinder
- Finder for the container that can scroll, for instance a ListViewdirection
- specifies where the view port will move instead of the fingerprotected boolean detectEnd(android.view.accessibility.AccessibilityEvent event, Direction.Axis axis)
public final Direction.DirectionConverter getDirectionConverter()
ScrollStepStrategy
Direction.DirectionConverter
.getDirectionConverter
in interface ScrollStepStrategy
public void beginScrolling(DroidDriver driver, Finder containerFinder, Finder itemFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
beginScrolling
in interface ScrollStepStrategy
driver
- a DroidDriver instancecontainerFinder
- Finder for the container that can scroll, for instance a ListViewitemFinder
- Finder for the desired item; relative to containerFinder
direction
- specifies where the view port will move instead of the fingerpublic void endScrolling(DroidDriver driver, Finder containerFinder, Finder itemFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
endScrolling
in interface ScrollStepStrategy
driver
- a DroidDriver instancecontainerFinder
- Finder for the container that can scroll, for instance a ListViewitemFinder
- Finder for the desired item; relative to containerFinder
direction
- specifies where the view port will move instead of the fingerprotected android.view.accessibility.AccessibilityEvent doScrollAndReturnEvent(UiElement container, Direction.PhysicalDirection direction)
public void doScroll(UiElement container, Direction.PhysicalDirection direction)
ScrollStepStrategy
container
. Subclasses can override this to customize the
scroll action, for example, to adjust the scroll margins.doScroll
in interface ScrollStepStrategy
container
- the container that can scrolldirection
- specifies where the view port will move instead of the finger