简体   繁体   中英

galaxy s7 edge drag and drop

I have a user who has uprgraded from Samsung Galaxy S6 Edge to Samsung Galaxy S7 Edge.

My app has the ability to drag and drop playing card images.

The user indicates that this feature is not working on the S7 Edge but it did on the S6 Edge.

The dragging works, which suggests that the onTouch() and onDrag() are working but when an object is dropped it returns to its original position instead of the required position.

protected void measureDisplay() {
    // get info about screen size to determine style of images to use
    display = getWindowManager().getDefaultDisplay();
    size = new Point();
    display.getSize(size);

    displayMetrics = new DisplayMetrics();
    // get the density of the display
    display.getMetrics(displayMetrics);

    width = size.x;
    height = size.y;
}

private void measureBoard(View v) {
    // get the current view width and height
    float viewWidth = v.getWidth();
    float viewHeight = v.getHeight();

    // extract the image offsets inside the view
    Matrix matrix = ((ImageView) v).getImageMatrix();
    float[] values = new float[9];
    matrix.getValues(values);
    boardLeft = values[2]; // the X offset
    boardRight = viewWidth - boardLeft;
    boardTop = values[5]; // the Y offset
    boardBottom = viewHeight - boardTop;
    cardOffsetW = (boardRight - boardLeft) / 10;
    cardOffsetH = (boardBottom - boardTop) / 10;
}

At least some of the problems with behind-the-scenes display scaling can be solved by finding out if the user has Samsung's Game Tuner installed. It changes the Resolution Ratio for any "Game" app, and possibly does it without ever being opened.

To resolve, ask users to specify Resolution Ratio for your game in Game Tuner (they can do that on a per-app basis). See more here: DragEventListener not working on Samsung S7 (6.0)

I am working on an update for my game which would pop a message if they have Game Tuner installed.

This app: https://play.google.com/store/apps/details?id=com.evozi.displayscaling will resolve the issue on Samsung devices. In our game we faced with similar problem and solution was this settings change. I hope that Samsung will provide fix with some next OS update so we do need to inform users about this bug and forcing them to change settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM