android - How to create custom methods to swipe my view up and down, Espresso - ViewActions -


i want create custom methods swipe view , down, example 25% down/up, or other cases. tried override methods this:

public static viewaction swipedown(){     return new generalswipeaction(swipe.fast, generallocation.center,              generallocation.top_center, press.finger); } 

but it's top center , need shorter ones. wanted use new coordinatesprovider() :

public static viewaction swipedown(){     return new generalswipeaction(swipe.fast, new coordinatesprovider() {         @override         public float[] calculatecoordinates(view view) {             return new float[0];         }     },             generallocation.top_center, press.finger); } 

...and might answer, don't know how calculate coordinates.

robotium has drag() function pretty similar swipe[direction] functions in espresso, uses defined coordinates.

* @param fromx x coordinate of initial touch, in screen coordinates * @param tox x coordinate of drag destination, in screen coordinates * @param fromy y coordinate of initial touch, in screen coordinates * @param toy y coordinate of drag destination, in screen coordinates * @param stepcount how many move steps include in drag. less steps results in faster drag

check https://github.com/robotiumtech/robotium/blob/b69dcf740baabec48c91999e523377faef79682e/robotium-solo/src/main/java/com/robotium/solo/solo.java

you can use both frameworks along or try rewrite robotium's drag function in own way.

this might handful: https://github.com/piotrek1543/robotium-showcase


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -