android.view.SurfaceView.getContext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中android.view.SurfaceView.getContext()方法的一些代码示例,展示了SurfaceView.getContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SurfaceView.getContext()方法的具体详情如下:
包路径:android.view.SurfaceView
类名称:SurfaceView
方法名:getContext

SurfaceView.getContext介绍

暂无

代码示例

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

public Camera2Base(SurfaceView surfaceView) {
 this.surfaceView = surfaceView;
 this.context = surfaceView.getContext();
 init(context);
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

public Camera1ApiManager(SurfaceView surfaceView, GetCameraData getCameraData) {
 this.surfaceView = surfaceView;
 this.getCameraData = getCameraData;
 this.context = surfaceView.getContext();
 init();
}

代码示例来源:origin: jiangdongguo/OkCamera

private void startAcceleratorSensor() {
  mAccelerSensor = SensorAccelerator.getSensorInstance();
  mAccelerSensor.startSensorAccelerometer(mSurfaceViewRf.get().getContext(), new SensorAccelerator.OnSensorChangedResult() {
    @Override
    public void onMoving(int x, int y, int z) {
    }
    @Override
    public void onStopped() {
      // 开始对焦
      cameraFocus();
    }
  });
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

public Camera1Base(SurfaceView surfaceView) {
 context = surfaceView.getContext();
 cameraManager = new Camera1ApiManager(surfaceView, this);
 init();
}

代码示例来源:origin: vbier/habpanelviewer

public MotionVisualizer(SurfaceView motionView, NavigationView navigationView, SharedPreferences preferences, int cameraRotation, int scaledSize) {
  mMotionView = motionView;
  mNavigationView = navigationView;
  mPreferences = preferences;
  mCameraRotation = cameraRotation;
  int newDeviceRotation = ((Activity) mMotionView.getContext()).getWindowManager().getDefaultDisplay().getRotation();
  setDeviceRotation(newDeviceRotation);
  mMotionView.setZOrderOnTop(true);
  mMotionView.getHolder().setFormat(PixelFormat.TRANSPARENT);
  mPaint.setColor(Color.WHITE);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setTextSize(scaledSize);
  Rect bounds = new Rect();
  mPaint.getTextBounds(mNavigationView.getContext().getString(R.string.motion), 0, 6, bounds);
  mMotionTextWidth = bounds.width();
  mPaint.getTextBounds(mNavigationView.getContext().getString(R.string.tooDark), 0, 8, bounds);
  mDarkTextWidth = bounds.width();
}

代码示例来源:origin: jiangdongguo/OkCamera

private void startOrientationSensor() {
  mOriSensor = SensorOrientation.getInstance(mSurfaceViewRf.get().getContext());
  mOriSensor.startSensorOrientation(new SensorOrientation.OnChangedListener() {
    @Override
    public void onOrientatonChanged(int orientation) {
      // 假定某个范围,确定手机当前方向
      // mPhoneDegree = 0,正常垂直方向
      // mPhoneDegree = 90,向右水平方向 ...
      int rotate = 0;
      if ((orientation >= 0 && orientation <= 45) || (orientation > 315)) {
        rotate = 0;
      } else if (orientation > 45 && orientation <= 135) {
        rotate = 90;
      } else if (orientation > 135 && orientation <= 225) {
        rotate = 180;
      } else if (orientation > 225 && orientation <= 315) {
        rotate = 270;
      } else {
        rotate = 0;
      }
      if (rotate == orientation)
        return;
      mPhoneDegree = rotate;
      Log.i(TAG, "手机方向角度:" + mPhoneDegree);
    }
  });
  mOriSensor.enable();
}

相关文章