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.graphics.PixelFormat;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.DragEvent;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
|
@ -26,6 +27,7 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
||||||
private float y;
|
private float y;
|
||||||
private float touchX;
|
private float touchX;
|
||||||
private float touchY;
|
private float touchY;
|
||||||
|
private boolean dragEnabled;
|
||||||
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||||
|
|
||||||
public LinphoneOverlay(Context context, AttributeSet attrs, int defStyle) {
|
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);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
setOnLongClickListener(new OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
dragEnabled = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinphoneOverlay(Context context, AttributeSet attrs) {
|
public LinphoneOverlay(Context context, AttributeSet attrs) {
|
||||||
|
@ -95,11 +104,14 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
||||||
touchY = event.getY();
|
touchY = event.getY();
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
if (dragEnabled) {
|
||||||
updateViewPostion();
|
updateViewPostion();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
touchX = touchY = 0;
|
touchX = touchY = 0;
|
||||||
|
dragEnabled = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue