本文整理汇总了Java中android.hardware.SensorManager.SENSOR_DELAY_UI属性的典型用法代码示例。如果您正苦于以下问题:Java SensorManager.SENSOR_DELAY_UI属性的具体用法?Java SensorManager.SENSOR_DELAY_UI怎么用?Java SensorManager.SENSOR_DELAY_UI使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.hardware.SensorManager
的用法示例。
在下文中一共展示了SensorManager.SENSOR_DELAY_UI属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
private void init(Context context) {
mSensorDelay = SensorManager.SENSOR_DELAY_UI;
if (Logger.DEBUG_OPENGL) {
setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS);
}
// Wrapper set so the renderer can
// access the gl transformation matrixes.
setGLWrapper(new GLWrapper() {
@Override
public GL wrap(GL gl) {
return new MatrixTrackingGL(gl);
}
});
mRenderer = createRenderer();
mRenderer.setOnBeyondarObjectRenderedListener(this);
setEGLConfigChooser(8, 8, 8, 8, 16, 0);
getHolder().setFormat(PixelFormat.TRANSLUCENT);
setRenderer(mRenderer);
requestFocus();
// This call will allow the GLSurface to be on the top of all the
// Surfaces. It is needed because when the camera is rotated the camera
// tend to overlap the GLSurface.
setZOrderMediaOverlay(true);
setFocusableInTouchMode(true);
}
示例2: addOrientationListener
private void addOrientationListener() {
listener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_UI) {
public void onOrientationChanged(int orientation) {
if ((orientation >= 230 && orientation <= 290) || (orientation >= 70 && orientation <= 90)) {
portrait.setText("True");
}
}
};
if (listener.canDetectOrientation()) listener.enable();
}
示例3: sensorsSpeed
@ProtoMethod(description = "Set the speed of the sensor 'slow', 'fast', 'normal'", example = "")
@ProtoMethodParam(params = {"speed=['slow', 'fast', 'normal']"})
public void sensorsSpeed(String speed) {
if (speed.equals("slow")) {
this.speed = SensorManager.SENSOR_DELAY_UI;
} else if (speed.equals("fast")) {
this.speed = SensorManager.SENSOR_DELAY_FASTEST;
} else {
this.speed = SensorManager.SENSOR_DELAY_NORMAL;
}
}
示例4: before
@Override
protected void before(XParam param) throws Throwable {
switch (mMethod) {
case getDefaultSensor:
if (isRestricted(param))
param.setResult(null);
else if (param.args.length > 0 && param.args[0] instanceof Integer)
if (isRestricted(param, (Integer) param.args[0]))
param.setResult(null);
break;
case getSensorList:
if (isRestricted(param))
param.setResult(new ArrayList<Sensor>());
else if (param.args.length > 0 && param.args[0] instanceof Integer)
if (isRestricted(param, (Integer) param.args[0]))
param.setResult(new ArrayList<Sensor>());
break;
case registerListener:
if (param.args.length > 2 && param.args[1] instanceof Sensor && param.args[2] instanceof Integer) {
int type = ((Sensor) param.args[1]).getType();
if (type == Sensor.TYPE_GYROSCOPE || type == Sensor.TYPE_GYROSCOPE_UNCALIBRATED) {
int rateUs = (Integer) param.args[2];
// http://developer.android.com/guide/topics/sensors/sensors_overview.html
if (rateUs == SensorManager.SENSOR_DELAY_NORMAL)
return; // 200,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_UI)
return; // 60,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_GAME)
return; // 20,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_FASTEST)
; // 0 us
if (rateUs < cMaxRateUs) // 10,000 us
if (isRestricted(param))
param.args[2] = cMaxRateUs;
}
}
break;
}
}