[Android Apps and Games] Mohammad_Adib:
Progress!

After a TON of coding and math. I got the new swipe detector to work on the right also. Swipes are registered correctly on the white glowing edge and I coded this in a way that moving this to the top or bottom edge will be easier in the future.

You should've seen the look on my face when it finally worked. This is super complicated stuff :eek:

Allow me to throw some beautiful code at you:

This is the magic behind the tabs.

@Override
public boolean onTouchHandleMove(int id, Window window, View view, MotionEvent event) {
StandOutLayoutParams params = window.getLayoutParams();

// how much you have to move in either direction in order for the
// gesture to be a move and not tap

int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();

window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();

if (window.touchInfo.moving || Math.abs(totalDeltaX) >= params.threshold || Math.abs(totalDeltaY) >= params.threshold) {
window.touchInfo.moving = true;

// if window is moveable
if (Utils.isSet(window.flags, StandOutFlags.FLAG_BODY_MOVE_ENABLE)) {

// update the position of the window
if (event.getPointerCount() == 1) {
// params.x += deltaX;
params.y += deltaY;
}

window.edit().setPosition(params.x, params.y).commit();
}
}
break;
case MotionEvent.ACTION_UP:
window.touchInfo.moving = false;
save(window);
break;
}

onMove(id, window, view, event);

return true;
}

public boolean onTouchHandleMoveTop(int id, Window window, View view, MotionEvent event) {
StandOutLayoutParams params = window.getLayoutParams();

// how much you have to move in either direction in order for the
// gesture to be a move and not tap

int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();

window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();

if (window.touchInfo.moving || Math.abs(totalDeltaX) >= params.threshold || Math.abs(totalDeltaY) >= params.threshold) {
window.touchInfo.moving = true;

// if window is moveable
if (Utils.isSet(window.flags, StandOutFlags.FLAG_BODY_MOVE_ENABLE)) {

// update the position of the window
if (event.getPointerCount() == 1) {
// params.x += deltaX;
params.y += deltaY;
params.y = Math.max(0, params.y);
if (!(params.y == 0 && deltaY < 0))
params.height -= deltaY;
params.height = Math.max(100, params.height);
}

window.edit().setPosition(params.x, params.y).commit();
}
}
break;
case MotionEvent.ACTION_UP:
window.touchInfo.moving = false;
save(window);
break;
}

onMove(id, window, view, event);

return true;
}

public boolean onTouchHandleMoveBottom(int id, Window window, View view, MotionEvent event) {
StandOutLayoutParams params = window.getLayoutParams();

// how much you have to move in either direction in order for the
// gesture to be a move and not tap

int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();

window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();

if (window.touchInfo.moving || Math.abs(totalDeltaX) >= params.threshold || Math.abs(totalDeltaY) >= params.threshold) {
window.touchInfo.moving = true;

// if window is moveable
if (Utils.isSet(window.flags, StandOutFlags.FLAG_BODY_MOVE_ENABLE)) {

// update the position of the window
if (event.getPointerCount() == 1) {
// params.x += deltaX;
params.height += deltaY;
params.height = Math.max(100, params.height);
}

window.edit().setPosition(params.x, params.y).commit();
}
}
break;
case MotionEvent.ACTION_UP:
window.touchInfo.moving = false;
save(window);
break;
}

onMove(id, window, view, event);

return true;
}

P.S Most of this was written by Mark Wei. What a pingpongboss