Updated way overlay works: one click to go back to call, long click to enable the drag&drop
This commit is contained in:
parent
50b4846d43
commit
ee19177a0c
1 changed files with 14 additions and 2 deletions
|
@ -12,6 +12,7 @@ import android.content.Intent;
|
|||
import android.graphics.PixelFormat;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.DragEvent;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceView;
|
||||
|
@ -26,6 +27,7 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
|||
private float y;
|
||||
private float touchX;
|
||||
private float touchY;
|
||||
private boolean dragEnabled;
|
||||
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||
|
||||
public LinphoneOverlay(Context context, AttributeSet attrs, int defStyle) {
|
||||
|
@ -71,6 +73,13 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
|||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
setOnLongClickListener(new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
dragEnabled = true;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public LinphoneOverlay(Context context, AttributeSet attrs) {
|
||||
|
@ -95,11 +104,14 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
|||
touchY = event.getY();
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
updateViewPostion();
|
||||
if (dragEnabled) {
|
||||
updateViewPostion();
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
case MotionEvent.ACTION_UP:
|
||||
touchX = touchY = 0;
|
||||
dragEnabled = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue