91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 19KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-05
  • 語言: Java
  • 標簽: surfaceView??手勢??

資源簡介

android手勢縮放 surfaceview,肯定不會運行起來,手勢的基本算法在里面,當時畢業公司讓做的一個小功能。

資源截圖

代碼片段和文件信息


public?class?MainActivity?extends?Activity?implements?OnTouchListener
onclickListener?OnGestureListener
SurfaceHolder.Callback?OnDoubleTapListener?{
/****************************************?手勢相關參數可刪除測試?******************************************************/
private?SurfaceHolder?glSurfaceHolder?=?null;
private?SurfaceHolder?surfaceHolder?=?null;
/**?視頻參數?**/
private?frameLayout.LayoutParams?lp?=?null;
private?int?lastX?lastY;
private?int?cenX?cenY;
private?PointF?mid?=?new?PointF();//?兩指中點
static?final?int?NONE?=?0;
static?final?int?DRAG?=?1;?//?拖動中
static?final?int?ZOOM?=?2;?//?縮放中
int?mode?=?NONE;?//?當前的事件
private?float?scale?=?1.0f;
private?static?final?float?MAX_SCALE?=?8.0f;
private?static?final?float?MIN_SCALE?=?1.0f;
private?float?beforeLenght;?//?兩觸點距離
private?float?afterLenght;?//?兩觸點距離
private?static?final?float?sfRation?=?0.05f;
private?int?moveX?moveY;
private?boolean?statusScroll?=?false;//?執行scroll狀態
/*********************************************************************************************************/

/****************************************?手勢相關參數可刪除測試?******************************************************/

private?RelativeLayout?parent_layout;//?UI頂級容器
private?frameLayout?frame;
private?RelativeLayout?gesture_volume_layout;//?手勢調節音量容器
private?RelativeLayout?gesture_bright_layout;//?手勢調節亮度容器
private?static?final?String?TAG?=?“CBB_MediaPlayer“;
private?int?num?=?0;

@Override
protected?void?onCreate(Bundle?savedInstanceState)?{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
screenLock?=?new?ScreenLock(true?this);
glSurfaceView?=?(GLSurfaceView)?findViewById(R.id.glSurfaceView);
surfaceView?=?(SurfaceView)?findViewById(R.id.surfaceView);
surfaceView.setZOrderOnTop(true);//?顯示層次
surfaceView.setZOrderMediaOverlay(true);//?顯示層次

//?glSurfaceView.setZOrderOnTop(true);
//?glSurfaceView.setZOrderMediaOverlay(true);
//?glSurfaceView.bringToFront();
//?SurfaceHolder?surfaceHolder?=?surfaceView.getHolder();
//?surfaceHolder.setFormat(PixelFormat.TRANSPARENT);
//?surfaceHolder.addCallback(this);



surfaceView.dispatchWindowVisibilityChanged(View.VISIBLE);



}


/**
?*?初始化UI控件
?*?
?*?*/
private?void?initComponent()?{
lp?=?(frameLayout.LayoutParams)?surfaceView.getLayoutParams();
surfaceView.setLayoutParams(lp);

glSurfaceHolder?=?glSurfaceView.getHolder();
glSurfaceHolder.addCallback(this);
glSurfaceView.setKeepScreenOn(true);

surfaceHolder?=?surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceView.setKeepScreenOn(true);
//?將Window設置為可以超出屏幕尺寸
mWindow?=?getWindow();
mWindow.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

DisplayMetrics?display?=?new?DisplayMetrics();
display?=?this.getResources().getDisplayMetrics();
screenWidth?=?display.widthPixel

評論

共有 條評論