Sha256: a5592f67fc77a49f575ef004491d85416fb2cd0c888ebf68e1afbb3b6624b0b4

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

package sh.calaba.instrumentationbackend.actions.gestures;

import android.view.Display;
import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.actions.Action;

/**
 * <p>
 * Action that performs a long press on given coordinates.
 * </p>
 * <p>
 * Parameters:
 * <ul>
 * <li>args[0]: x coordinate (float)</li>
 * <li>args[1]: y coordinate (float)</li>
 * <li>args[2]: length of the long press in millisecond (optional, integer)</li>
 * </ul>
 * </p>
 */
public class LongPressCoordinate implements Action {
    @Override
    public Result execute(String... args) {
        Display display = InstrumentationBackend.solo.getCurrentActivity().getWindowManager().getDefaultDisplay();

        float x = Float.parseFloat(args[0]);
        float y = Float.parseFloat(args[1]);
		if (args.length > 2) {
			int time = Integer.parseInt(args[2]);
			InstrumentationBackend.solo.clickLongOnScreen(x, y, time);
		} else {
			InstrumentationBackend.solo.clickLongOnScreen(x, y);
		}

        return Result.successResult();
    }

    @Override
    public String key() {
        return "long_press_coordinate";
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
calabash-android-0.5.2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java
calabash-android-0.5.2.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java
calabash-android-0.5.1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java
calabash-android-0.5.0 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java
calabash-android-0.5.0.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java
calabash-android-0.5.0.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java