• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Point类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.musala.atmosphere.commons.geometry.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Point类属于com.musala.atmosphere.commons.geometry包,在下文中一共展示了Point类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onStartCommand

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Point touchLocation = (Point) intent.getSerializableExtra(LocationPointerConstants.CENTER_POINT_INTENT_NAME.getValue());

    WindowManager.LayoutParams params = new WindowManager.LayoutParams(densityIndependentPixelToPixel(LOCATION_POINTER_DIAMETER),
                                                                       densityIndependentPixelToPixel(LOCATION_POINTER_DIAMETER),
                                                                       WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                                                                       WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                                                                               | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                                                                               | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
                                                                       PixelFormat.TRANSLUCENT);

    params.gravity = Gravity.TOP | Gravity.LEFT;
    params.x = touchLocation.getX() - densityIndependentPixelToPixel(LOCATION_POINTER_RADIUS);
    params.y = (touchLocation.getY() - densityIndependentPixelToPixel(LOCATION_POINTER_RADIUS))
            - getStatusBarHeight();

    ShowPointerTask locationPointerTask;

    locationPointerTask = new ShowPointerTask(params);
    locationPointerTask.execute(params);

    return START_NOT_STICKY;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-service,代码行数:25,代码来源:LocationPointerService.java


示例2: parse

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
/**
 * Converts a UI element bounds in the format <b>[startX,startY][endX,endY]</b> (fetched from the UI XML file) to a
 * Pair&lt;Point, Point;&gt; format.
 * 
 * @param bounds
 *        String containing UiElement bounds to be parsed.
 * @return Bounds pair containing the UiElement bounds.
 */
public static Bounds parse(String bounds) {
    final String BOUNDS_STRING_PATTERN = "\\[(-*\\d+),(-*\\d+)\\]\\[(-*\\d+),(-*\\d+)\\]";
    final Pattern BOUNDS_PATTERN = Pattern.compile(BOUNDS_STRING_PATTERN);
    final Matcher BOUNDS_MATCHER = BOUNDS_PATTERN.matcher(bounds);

    if (BOUNDS_MATCHER.find()) {
        int firstPointX = Integer.parseInt(BOUNDS_MATCHER.group(1));
        int firstPointY = Integer.parseInt(BOUNDS_MATCHER.group(2));
        Point first = new Point(firstPointX, firstPointY);

        int secondPointX = Integer.parseInt(BOUNDS_MATCHER.group(3));
        int secondPointY = Integer.parseInt(BOUNDS_MATCHER.group(4));
        Point second = new Point(secondPointX, secondPointY);

        Bounds result = new Bounds(first, second);
        return result;
    } else {
        String message = String.format("' %s ' is not in the required bounds format.", bounds);
        LOGGER.error(message);
        throw new IllegalArgumentException(message);
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-commons,代码行数:31,代码来源:UiElementBoundsParser.java


示例3: listOfAccessibilityElementsDeserializerTest

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void listOfAccessibilityElementsDeserializerTest() {
    AccessibilityElement firstElement = new AccessibilityElement();
    AccessibilityElement secondElement = new AccessibilityElement();
    AccessibilityElement thirdElement = new AccessibilityElement();

    firstElement.setPath(TestConst.TEST_PATH);
    secondElement.setEnabled(true);
    thirdElement.setBounds(new Bounds(new Point(0, 0), new Point(4, 4)));

    List<AccessibilityElement> list = Arrays.asList(firstElement, secondElement, thirdElement);

    List<AccessibilityElement> deserializedResponseData = (List<AccessibilityElement>) getExpectedResponseData(RoutingAction.GET_UI_ELEMENTS,
                                                                                                               list);

    AccessibilityElement actualFirstElement = deserializedResponseData.get(0);
    AccessibilityElement actualSecondElement = deserializedResponseData.get(1);
    AccessibilityElement actualThirdElement = deserializedResponseData.get(2);

    Assert.assertEquals(TestConst.TEST_PATH, actualFirstElement.getPath());
    Assert.assertEquals(3, deserializedResponseData.size());
    Assert.assertTrue(actualSecondElement.isEnabled());
    Assert.assertEquals(2, actualThirdElement.getBounds().getCenter().getX());
    Assert.assertEquals(2, actualThirdElement.getBounds().getCenter().getY());
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-commons,代码行数:26,代码来源:CollectionsDeserialziationTest.java


示例4: testDragToPoint

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDragToPoint() throws Exception {
    Screen deviceScreen = testDevice.getActiveScreen();

    UiElementSelector imageElementSelector = new UiElementSelector();
    imageElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, IMAGE_ELEMENT_ID);
    UiElement imageElement = deviceScreen.getElement(imageElementSelector);

    UiElementSelector textElementSelector = new UiElementSelector();
    textElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, TEXT_ELEMENT_ID);
    UiElement texElement = deviceScreen.getElement(textElementSelector);

    Point destinationPoint = texElement.getProperties().getBounds().getCenter();
    imageElement.drag(destinationPoint);

    deviceScreen.updateScreen();
    imageElement = deviceScreen.getElement(imageElementSelector);
    Point actualPoint = imageElement.getProperties().getBounds().getCenter();
    assertEquals(MESSAGE_TEST_FAIL, destinationPoint, actualPoint);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:21,代码来源:DragTest.java


示例5: testDragToUiElement

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDragToUiElement() throws Exception {
    Screen deviceScreen = testDevice.getActiveScreen();

    UiElementSelector imageElementSelector = new UiElementSelector();
    imageElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, IMAGE_ELEMENT_ID);
    UiElement imageElement = deviceScreen.getElement(imageElementSelector);

    UiElementSelector textElementSelector = new UiElementSelector();
    textElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, TEXT_ELEMENT_ID);
    UiElement textElement = deviceScreen.getElement(textElementSelector);

    imageElement.drag(textElement);

    deviceScreen.updateScreen();

    imageElement = deviceScreen.getElement(imageElementSelector);
    textElement = deviceScreen.getElement(textElementSelector);

    Point expectedPoint = textElement.getProperties().getBounds().getCenter();
    Point actualPoint = imageElement.getProperties().getBounds().getCenter();

    assertEquals(MESSAGE_TEST_FAIL, expectedPoint, actualPoint);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:25,代码来源:DragTest.java


示例6: testDragToUiElementSelector

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDragToUiElementSelector() throws Exception {
    Screen deviceScreen = testDevice.getActiveScreen();

    UiElementSelector imageElementSelector = new UiElementSelector();
    imageElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, IMAGE_ELEMENT_ID);
    UiElement imageElement = deviceScreen.getElement(imageElementSelector);

    UiElementSelector textElementSelector = new UiElementSelector();
    textElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, TEXT_ELEMENT_ID);
    UiElement texElement = deviceScreen.getElement(textElementSelector);

    imageElement.drag(textElementSelector);

    imageElement = deviceScreen.getElement(imageElementSelector);
    texElement = deviceScreen.getElement(textElementSelector);

    Point expectedPoint = texElement.getProperties().getBounds().getCenter();
    Point actualPoint = imageElement.getProperties().getBounds().getCenter();

    assertEquals(MESSAGE_TEST_FAIL, expectedPoint, actualPoint);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:23,代码来源:DragTest.java


示例7: testDragToElementToText

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDragToElementToText() throws Exception {
    Screen deviceScreen = testDevice.getActiveScreen();

    UiElementSelector imageElementSelector = new UiElementSelector();
    imageElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, IMAGE_ELEMENT_ID);
    UiElement imageElement = deviceScreen.getElement(imageElementSelector);

    UiElementSelector textElementSelector = new UiElementSelector();
    textElementSelector.addSelectionAttribute(CssAttribute.RESOURCE_ID, TEXT_ELEMENT_ID);
    UiElement textElement = deviceScreen.getElement(textElementSelector);

    imageElement.drag("Drag Test");

    deviceScreen.updateScreen();
    imageElement = deviceScreen.getElement(imageElementSelector);

    Point expectedPoint = textElement.getProperties().getBounds().getCenter();
    Point actualPoint = imageElement.getProperties().getBounds().getCenter();
    assertEquals(MESSAGE_TEST_FAIL, expectedPoint, actualPoint);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:22,代码来源:DragTest.java


示例8: testDeviceDoubleTap

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDeviceDoubleTap() throws Exception {
    UiElement doubleTapValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());

    // getting the point at the center of the element
    doubleTapValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    UiElementPropertiesContainer doubleTapValidatorProperties = doubleTapValidator.getProperties();
    Bounds elementBounds = doubleTapValidatorProperties.getBounds();
    Point centerPoint = elementBounds.getCenter();

    boolean tapResult = testDevice.doubleTap(centerPoint);

    // assert that the method indicates success
    assertTrue("Double tapping UI element returned false.", tapResult);

    // assert that UI element has received a double tap gesture
    doubleTapValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    assertDoubleTapped("The element did not recieve a double tap gesture.");
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:20,代码来源:DoubleTapTest.java


示例9: testRelativeDoubleTap

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testRelativeDoubleTap() throws Exception {
    UiElement doubleTapValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());

    // the tap point is relative to the element's coordinates
    doubleTapValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    Point tapPoint = new Point(0, 0);
    boolean tapResult = doubleTapValidator.doubleTap(tapPoint);

    // assert that the method indicated success
    assertTrue("Double tapping UI element returned false.", tapResult);

    // assert that UI element has received a double tap gesture
    doubleTapValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    assertDoubleTapped("The element did not recieve a double tap gesture.");
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:17,代码来源:DoubleTapTest.java


示例10: testRelativeTap

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testRelativeTap() throws Exception {
    UiElement imeRelativeLayout = getElementByContentDescriptor(IME_RELATIVE_LAYOUT_CONTENT_DESCRIPTOR);
    UiElementPropertiesContainer imeRelativeLayoutProperties = imeRelativeLayout.getProperties();

    UiElement emptyTextBox = getElementByContentDescriptor(ContentDescriptor.EMPTY_TEXT_BOX.toString());
    UiElementPropertiesContainer emptyTextBoxProperties = emptyTextBox.getProperties();

    Bounds emptyTextBoxBoundsAttributeValue = emptyTextBoxProperties.getBounds();
    Point emptyTextBoxUpperLeftCorner = emptyTextBoxBoundsAttributeValue.getUpperLeftCorner();

    Bounds imeRelativeLayoutBoundsAttributeValue = imeRelativeLayoutProperties.getBounds();
    Point imeRelativeLayoutUpperLeftCorner = imeRelativeLayoutBoundsAttributeValue.getRelativePoint(emptyTextBoxUpperLeftCorner);

    assertTrue(TAPPING_SCREEN_FAILED_MESSAGE, imeRelativeLayout.tap(imeRelativeLayoutUpperLeftCorner));

    Thread.sleep(TIMEOUT);

    assertInputTextBoxIsFocused(FOCUSING_ELEMENT_FAILED_MESSAGE);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:21,代码来源:TapTest.java


示例11: testSetScreenOffTimeoutOnRealDevice

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testSetScreenOffTimeoutOnRealDevice() throws Exception {
    DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.DEVICE_ONLY);
    DeviceSelector testDeviceSelector = selectorBuilder.build();

    try {
        initTestDevice(testDeviceSelector);
    } catch (NoAvailableDeviceFoundException e) {
    }

    assumeNotNull(testDevice);
    setTestDevice(testDevice);
    startMainActivity();

    defaultTimeOut = testDevice.getScreenOffTimeout();

    testDevice.setScreenOffTimeout(SCREEN_OFF_TIMEOUT);
    testDevice.tapScreenLocation(new Point(2, 3));
    assertTrue("Device is not awake.", testDevice.isAwake());

    assertEquals("Expected screen of timeout does not match.", testDevice.getScreenOffTimeout(), SCREEN_OFF_TIMEOUT);

    Thread.sleep(SCREEN_OFF_TIMEOUT + TIME_TO_WAIT);
    assertFalse("Device is awake.", testDevice.isAwake());
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:26,代码来源:ScreenOffTimeoutTest.java


示例12: testDeviceSwipe

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDeviceSwipe() throws Exception {
    UiElement swipeValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    UiElementPropertiesContainer swipeValidatorProperties = swipeValidator.getProperties();
    Bounds elementBounds = swipeValidatorProperties.getBounds();
    Point centerPoint = elementBounds.getCenter();

    SwipeDirection directionDown = SwipeDirection.UP;

    boolean swipeResult = testDevice.swipe(centerPoint, directionDown);

    // assert that the method indicates success
    assertTrue("Swipping returned false.", swipeResult);

    assertSwipedUp("The element did not recieve a swipe gesture.");
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:17,代码来源:SwipeTest.java


示例13: testDevicePinchIn

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDevicePinchIn() throws Exception {
    UiElement gestureValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());

    // getting the point at the center of the element
    gestureValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    UiElementPropertiesContainer gestureValidatorProperties = gestureValidator.getProperties();

    Bounds elementBounds = gestureValidatorProperties.getBounds();
    Point firstFingerInitial = elementBounds.getUpperLeftCorner();
    Point secondFingerInitial = elementBounds.getLowerRightCorner();

    boolean pinchInResult = testDevice.pinchIn(firstFingerInitial, secondFingerInitial);

    // assert that the method indicates success
    assertTrue("Pinching in UiElement returned false.", pinchInResult);

    // assert that UI element has received a pinch in gesture
    assertPinchedIn("The element did not recieve a pinch in gesture.");
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:21,代码来源:PinchTest.java


示例14: testDevicePinchOut

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test
public void testDevicePinchOut() throws Exception {
    UiElement gestureValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());

    // getting the point at the center of the element
    gestureValidator = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());
    UiElementPropertiesContainer gestureValidatorProperties = gestureValidator.getProperties();

    Bounds elementBounds = gestureValidatorProperties.getBounds();
    Point firstFingerEnd = elementBounds.getUpperLeftCorner();
    Point secondFingerEnd = elementBounds.getLowerRightCorner();

    boolean pinchOutResult = testDevice.pinchOut(firstFingerEnd, secondFingerEnd);

    // assert that the method indicates success
    assertTrue("Pinching out UiElement returned false.", pinchOutResult);

    // assert that UI element has received a pinch out gesture
    assertPinchedOut("The element did not recieve a pinch out gesture.");
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:21,代码来源:PinchTest.java


示例15: testFailedLongPress

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testFailedLongPress() throws Exception {

    UiElement longPressTextField = getElementByContentDescriptor(ContentDescriptor.GESTURE_VALIDATOR.toString());

    // make sure to click outside the element
    final Bounds elementBounds = longPressTextField.getProperties().getBounds();
    Point lowerRightCorner = elementBounds.getLowerRightCorner();
    final int x = lowerRightCorner.getX();
    final int y = lowerRightCorner.getY();
    final int offset = 1;
    Point outerPoint = new Point(x + offset, y + offset);

    // long press
    boolean longPressResult = longPressTextField.longPress(outerPoint, LONG_PRESS_TIMEOUT);
    assertFalse("Text box for gesture verification was long pressed.", longPressResult);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:18,代码来源:LongPressTest.java


示例16: tapScreenLocation

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
/**
 * Executes a simple tap on the screen of this device at a specified location point.
 *
 * @param tapPoint
 *        - {@link Point Point} on the screen to tap on
 *
 * @return <code>true</code> if tapping screen is successful, <code>false</code> if it fails
 */
public boolean tapScreenLocation(Point tapPoint) {
    boolean isTapSuccessful = true;

    int tapPointX = tapPoint.getX();
    int tapPointY = tapPoint.getY();
    String query = "input tap " + tapPointX + " " + tapPointY;

    showTapLocation(tapPoint);

    try {
        shellCommandExecutor.execute(query);
    } catch (CommandFailedException e) {
        isTapSuccessful = false;
    }

    return isTapSuccessful;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:26,代码来源:GestureEntity.java


示例17: validatePointOnScreen

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
/**
 * Checks whether the given point is inside the bounds of the screen, and throws an {@link IllegalArgumentException}
 * otherwise.
 *
 * @param point
 *        - the point to be checked
 */
private void validatePointOnScreen(Point point) {
    Pair<Integer, Integer> resolution = deviceInformation.getResolution();

    boolean hasPositiveCoordinates = point.getX() >= 0 && point.getY() >= 0;
    boolean isOnScreen = point.getX() <= resolution.getKey() && point.getY() <= resolution.getValue();

    if (!hasPositiveCoordinates || !isOnScreen) {
        String exeptionMessageFormat = "The passed point with coordinates (%d, %d) is outside the bounds of the screen. Screen dimentions (%d, %d)";
        String message = String.format(exeptionMessageFormat,
                                       point.getX(),
                                       point.getY(),
                                       resolution.getKey(),
                                       resolution.getValue());
        LOGGER.error(message);
        throw new IllegalArgumentException(message);
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:25,代码来源:GestureEntity.java


示例18: tap

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
private boolean tap(UiElementPropertiesContainer element) {
    Bounds elementBounds = element.getBounds();
    Point centerPoint = elementBounds.getCenter();
    Point point = elementBounds.getRelativePoint(centerPoint);
    Point tapPoint = elementBounds.getUpperLeftCorner();
    tapPoint.addVector(point);

    boolean tapSuccessful = false;
    if (elementBounds.contains(tapPoint)) {
        tapSuccessful = gestureEntity.tapScreenLocation(tapPoint);
        finalizeUiElementOperation();
    }  else {
        String message = String.format("Point %s not in element bounds.", point.toString());
        LOGGER.error(message);
        throw new IllegalArgumentException(message);
    }

    return tapSuccessful;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:20,代码来源:GpsLocationEntity.java


示例19: createPinchIn

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
/**
 * Creates a pinch in {@link Gesture}.
 *
 * @param firstFingerInitial
 *        - the initial position of the first finger performing the gesture
 * @param secondFingerInitial
 *        - the initial position of the second finger performing the gesture
 * @return a {@link Gesture} that represents pinch in on a device.
 */
public static Gesture createPinchIn(Point firstFingerInitial, Point secondFingerInitial) {
    // calculating the point where the two fingers will meet
    int toX = (firstFingerInitial.getX() + secondFingerInitial.getX()) / 2;
    int toY = (firstFingerInitial.getY() + secondFingerInitial.getY()) / 2;
    Point to = new Point(toX, toY);

    Timeline firstFingerMovement = createScrollMovement(firstFingerInitial, to, PINCH_DURATION);
    Timeline secondFingerMovement = createScrollMovement(secondFingerInitial, to, PINCH_DURATION);

    Gesture pinchIn = new Gesture();
    pinchIn.add(firstFingerMovement);
    pinchIn.add(secondFingerMovement);

    return pinchIn;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:25,代码来源:GestureCreator.java


示例20: createPinchOut

import com.musala.atmosphere.commons.geometry.Point; //导入依赖的package包/类
/**
 * Creates a pinch out {@link Gesture}.
 *
 * @param firstFingerEnd
 *        - the point where the first finger will be at the end of the pinch
 * @param secondFingerEnd
 *        - the point where the second finger will be at the end of the pinch
 * @return a {@link Gesture} that represents pinch out on a device.
 */
public static Gesture createPinchOut(Point firstFingerEnd, Point secondFingerEnd) {
    // calculating the start point of the gesture
    int fromX = (firstFingerEnd.getX() + secondFingerEnd.getX()) / 2;
    int fromY = (firstFingerEnd.getY() + secondFingerEnd.getY()) / 2;
    Point from = new Point(fromX, fromY);

    Timeline firstFingerMovement = createScrollMovement(from, firstFingerEnd, PINCH_DURATION);
    Timeline secondFingerMovement = createScrollMovement(from, secondFingerEnd, PINCH_DURATION);

    Gesture pinchOut = new Gesture();
    pinchOut.add(firstFingerMovement);
    pinchOut.add(secondFingerMovement);

    return pinchOut;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:25,代码来源:GestureCreator.java



注:本文中的com.musala.atmosphere.commons.geometry.Point类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeInfo类代码示例发布时间:2022-05-22
下一篇:
Java QueryOptions类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap