android.support.test.espresso.action.GeneralSwipeAction Java Examples

The following examples show how to use android.support.test.espresso.action.GeneralSwipeAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: android-espresso-revealed   Author: Apress   File: CustomSwipeActions.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Fully customisable Swipe action for any need
 *
 * @param duration length of time a custom swipe should last for, in milliseconds.
 * @param from     for example [GeneralLocation.CENTER]
 * @param to       for example [GeneralLocation.BOTTOM_CENTER]
 */
public ViewAction swipeCustom(int duration, GeneralLocation from, GeneralLocation to) {
    CustomSwipe.CUSTOM.setSwipeDuration(duration);
    return actionWithAssertions(new GeneralSwipeAction(
            CustomSwipe.CUSTOM,
            translate(from, 0f, 0f),
            to,
            Press.FINGER)
    );
}
 
Example #2
Source Project: SwipeCoordinator   Author: VictorAlbertos   File: ViewActions.java    License: Apache License 2.0 5 votes vote down vote up
static ViewAction swipeRightNotReachingThreshold(Context context) {
  final float x = getWidthScreen(context) * 0.3f;
  return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
    @Override public float[] calculateCoordinates(View view) {
      return new float[] {x, 0f};
    }
  }, Press.FINGER);
}
 
Example #3
Source Project: SwipeCoordinator   Author: VictorAlbertos   File: ViewActions.java    License: Apache License 2.0 5 votes vote down vote up
static ViewAction swipeRightReachingThreshold(Context context) {
  final float x = getWidthScreen(context) * 0.8f;
  return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
    @Override public float[] calculateCoordinates(View view) {
      return new float[] {x, 0f};
    }
  }, Press.FINGER);
}
 
Example #4
Source Project: SwipeCoordinator   Author: VictorAlbertos   File: ViewActions.java    License: Apache License 2.0 5 votes vote down vote up
static ViewAction swipeDownNotReachingThreshold(Context context) {
  final float y = getHeightScreen(context) * 0.3f;
  return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
    @Override public float[] calculateCoordinates(View view) {
      return new float[] {0f, y};
    }
  }, Press.FINGER);
}
 
Example #5
Source Project: SwipeCoordinator   Author: VictorAlbertos   File: ViewActions.java    License: Apache License 2.0 5 votes vote down vote up
static ViewAction swipeDownReachingThreshold(Context context) {
  final float y = getHeightScreen(context) * 0.8f;
  return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
    @Override public float[] calculateCoordinates(View view) {
      return new float[] {0f, y};
    }
  }, Press.FINGER);
}
 
Example #6
Source Project: mobile-android-samples   Author: CartoDB   File: MapActivityTest.java    License: BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static ViewAction swipe() {

        CoordinatesProvider start = GeneralLocation.TOP_CENTER;
        CoordinatesProvider end = GeneralLocation.BOTTOM_CENTER;
        return new GeneralSwipeAction(Swipe.SLOW, start, end, Press.FINGER);
    }
 
Example #7
Source Project: PrettyBundle   Author: talenguyen   File: ExtViewActions.java    License: Apache License 2.0 4 votes vote down vote up
public static ViewAction swipeTop() {
    return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.BOTTOM_CENTER, GeneralLocation.TOP_CENTER, Press.FINGER);
}
 
Example #8
Source Project: PrettyBundle   Author: talenguyen   File: ExtViewActions.java    License: Apache License 2.0 4 votes vote down vote up
public static ViewAction swipeBottom() {
    return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER, GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
 
Example #9
Source Project: agera   Author: google   File: MainActivityTest.java    License: Apache License 2.0 4 votes vote down vote up
private static ViewAction swipeDown() {
  return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER,
      GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
 
Example #10
Source Project: agera   Author: google   File: MainActivityTest.java    License: Apache License 2.0 4 votes vote down vote up
private static ViewAction swipeDown() {
  return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER,
      GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
 
Example #11
Source Project: u2020-mvp   Author: LiveTyping   File: ViewActions.java    License: Apache License 2.0 4 votes vote down vote up
public static ViewAction swipeTop() {
    return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.BOTTOM_CENTER, GeneralLocation.TOP_CENTER, Press.FINGER);
}
 
Example #12
Source Project: u2020-mvp   Author: LiveTyping   File: ViewActions.java    License: Apache License 2.0 4 votes vote down vote up
public static ViewAction swipeBottom() {
    return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER, GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
 
Example #13
Source Project: espresso-macchiato   Author: nenick   File: EspDrawer.java    License: MIT License 2 votes vote down vote up
/**
 * Open the drawer.
 *
 * @since Espresso Macchiato 0.1
 */
public void open() {
    findDrawerLayout().perform(ViewActions.actionWithAssertions(new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_LEFT, GeneralLocation.CENTER_RIGHT, Press.FINGER)));
}
 
Example #14
Source Project: espresso-macchiato   Author: nenick   File: EspDrawer.java    License: MIT License 2 votes vote down vote up
/**
 * Close the drawer.
 *
 * @since Espresso Macchiato 0.1
 */
public void close() {
    findDrawerLayout().perform(ViewActions.actionWithAssertions(new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_RIGHT, GeneralLocation.CENTER_LEFT, Press.FINGER)));
}