List of usage examples for android.hardware SensorManager SENSOR_DELAY_GAME
int SENSOR_DELAY_GAME
To view the source code for android.hardware SensorManager SENSOR_DELAY_GAME.
Click Source Link
From source file:gov.nasa.arc.geocam.geocam.CameraActivity.java
@Override public void onResume() { super.onResume(); mServiceBound = bindService(new Intent(this, GeoCamService.class), mServiceConn, Context.BIND_AUTO_CREATE); if (!mServiceBound) { Log.e(GeoCamMobile.DEBUG_ID, "CameraActivity::onResume - error binding to service"); }/*w w w. j a v a 2 s . c o m*/ mForeground.foreground(); mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME); mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_GAME); mLatText.setText("Lat: unavailable"); mLonText.setText("Lon: unavailable"); IntentFilter filter = new IntentFilter(GeoCamMobile.LOCATION_CHANGED); this.registerReceiver(mLocationReceiver, filter); if (getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) { showDialog(DIALOG_HIDE_KEYBOARD); } // Unset focus and picture status flags when returning from another activity mLensIsFocused = false; mPictureTaken = false; }
From source file:com.example.android.camera2video.CameraActivity.java
@Override protected void onResume() { super.onResume(); /*/*ww w. ja v a 2 s . c o m*/ * when the activity is resumed, we acquire a wake-lock so that the * screen stays on, since the user will likely not be fiddling with the * screen or buttons. */ mSensorManager.registerListener(this, mAccSensor, SensorManager.SENSOR_DELAY_GAME); mSensorManager.registerListener(this, mGraSensor, SensorManager.SENSOR_DELAY_GAME); mSensorManager.registerListener(this, mLinSensor, SensorManager.SENSOR_DELAY_GAME); // mSensorManager.registerListener(this, GyrSensor, SensorManager.SENSOR_DELAY_GAME); mSensorManager.registerListener(this, mUgySensor, SensorManager.SENSOR_DELAY_GAME); mWakeLock.acquire(); }
From source file:info.alni.comete.android.Comete.java
@Override protected void onResume() { super.onResume(); sm.registerListener(sensorEventListener, mAccelSensor, SensorManager.SENSOR_DELAY_GAME); sm.registerListener(sensorEventListener, mOrienSensor, SensorManager.SENSOR_DELAY_GAME); // mHideControlsHandler.postDelayed(mHideControlsTask, 7500L); }
From source file:app.wz.MainActivity.java
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.menu_run_pause) { if (neuro.halt) { neuro.halt = false;//from w w w. j av a 2 s . c om setProgressBarIndeterminateVisibility(true); wakeLock.acquire(); if (prefs.getBoolean("use_server", false)) lock.acquire(); // for the system's orientation sensor registered listeners mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_GAME); synchronized (neuro) { neuro.notify(); } } else { haltNeuro(); } } else { if (!neuro.halt) { haltNeuro(); } } if (id == R.id.menu_device_connect) { bt.setDeviceTarget(BluetoothState.DEVICE_OTHER); /* if(bt.getServiceState() == BluetoothState.STATE_CONNECTED) bt.disconnect();*/ Intent intent = new Intent(getApplicationContext(), DeviceList.class); startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE); } else if (id == R.id.reset_Neuro) { neuro.updatePrefs(true); textRead.append("Reset Neuro \n"); textScroll.fullScroll(View.FOCUS_DOWN); } else if (id == R.id.menu_disconnect) { if (bt.getServiceState() == BluetoothState.STATE_CONNECTED) bt.disconnect(); } else if (id == R.id.remote_control) { if (bt.getServiceState() == BluetoothState.STATE_CONNECTED) { Intent intent = new Intent(this, JoystickActivity.class); startActivity(intent); } else { Toast.makeText(getApplicationContext(), "Not Connected", Toast.LENGTH_SHORT).show(); } return true; } else if (id == R.id.action_settings) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); return true; } else if (id == R.id.help) { LayoutInflater li = LayoutInflater.from(this); View view = li.inflate(R.layout.help, null); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setView(view); alert.show(); } return super.onOptionsItemSelected(item); }
From source file:com.android.gpstest.GpsTestActivity.java
@Override protected void onResume() { super.onResume(); if (GpsTestUtil.isRotationVectorSensorSupported(this)) { // Use the modern rotation vector sensors Sensor vectorSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR); mSensorManager.registerListener(this, vectorSensor, 16000); // ~60hz } else {/* w w w . j a va 2 s . c o m*/ // Use the legacy orientation sensors Sensor sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); if (sensor != null) { mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_GAME); } } if (!mService.isProviderEnabled(LocationManager.GPS_PROVIDER)) { promptEnableGps(); } /** * Check preferences to see how they should be initialized */ SharedPreferences settings = Application.getPrefs(); checkKeepScreenOn(settings); checkTimeAndDistance(settings); checkTutorial(settings); checkTrueNorth(settings); }
From source file:com.evgenyvyaz.cinaytaren.activity.FaceTrackerActivity.java
/** * Restarts the camera./* ww w .j a va 2s . c o m*/ */ @Override protected void onResume() { super.onResume(); /* mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_NORMAL);*/ mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_GAME); /* mSensorManager.registerListener(sensorEventListener, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);*/ startCameraSource(); }
From source file:com.richwareham.android.logallthethings.Camera2VideoFragment.java
@Override public void onResume() { super.onResume(); startBackgroundThread();/*from ww w.ja v a2 s .c o m*/ if (mTextureView.isAvailable()) { openCamera(mTextureView.getWidth(), mTextureView.getHeight()); } else { mTextureView.setSurfaceTextureListener(mSurfaceTextureListener); } // Start sensor logging for (Sensor s : mSensors) { mSensorManager.registerListener(this, s, SensorManager.SENSOR_DELAY_GAME); } }
From source file:com.google.android.apps.santatracker.doodles.tilt.SwimmingFragment.java
@Override protected void resume() { super.resume(); if (uiRefreshHandler != null) { sensorManager.registerListener(this, accelerometerSensor, SensorManager.SENSOR_DELAY_GAME); uiRefreshHandler.start(swimmingView); }/* w w w .j a v a 2s .co m*/ }
From source file:io.authme.sdk.widget.LockPatternView.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public LockPatternView(Context context, AttributeSet attrs) { super(context, attrs); senSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); senAccelerometer = senSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); if (senAccelerometer == null) { senAccelerometer = senSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); }//w w w . j a v a 2s.co m senSensorManager.registerListener(this, senAccelerometer, SensorManager.SENSOR_DELAY_GAME); sensGyro = senSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE); if (sensGyro != null) { senSensorManager.registerListener(this, sensGyro, SensorManager.SENSOR_DELAY_GAME); } senMagnetometer = senSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); if (senMagnetometer != null) { senSensorManager.registerListener(this, senMagnetometer, SensorManager.SENSOR_DELAY_GAME); } accelList = new ArrayList<>(); magnetics = new ArrayList<>(); gyrolist = new ArrayList<>(); rawXYList = new ArrayList<>(); velocityList = new ArrayList<>(); orientationArrayList = new ArrayList<>(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Alp_42447968_LockPatternView); final String aspect = a.getString(R.styleable.Alp_42447968_LockPatternView_alp_42447968_aspect); if ("square".equals(aspect)) { mAspect = ASPECT_SQUARE; } else if ("lock_width".equals(aspect)) { mAspect = ASPECT_LOCK_WIDTH; } else if ("lock_height".equals(aspect)) { mAspect = ASPECT_LOCK_HEIGHT; } else { mAspect = ASPECT_SQUARE; } setClickable(true); mPathPaint.setAntiAlias(true); mPathPaint.setDither(true); mRegularColor = getResources().getColor( ResourceUtils.resolveAttribute(getContext(), R.attr.alp_42447968_color_lock_pattern_view_regular)); mErrorColor = getResources().getColor( ResourceUtils.resolveAttribute(getContext(), R.attr.alp_42447968_color_lock_pattern_view_error)); mSuccessColor = getResources().getColor( ResourceUtils.resolveAttribute(getContext(), R.attr.alp_42447968_color_lock_pattern_view_success)); mRegularColor = a.getColor(R.styleable.Alp_42447968_LockPatternView_alp_42447968_regularColor, mRegularColor); mErrorColor = a.getColor(R.styleable.Alp_42447968_LockPatternView_alp_42447968_errorColor, mErrorColor); mSuccessColor = a.getColor(R.styleable.Alp_42447968_LockPatternView_alp_42447968_successColor, mSuccessColor); int pathColor = a.getColor(R.styleable.Alp_42447968_LockPatternView_alp_42447968_pathColor, mRegularColor); mPathPaint.setColor(pathColor); mPathPaint.setStyle(Paint.Style.STROKE); mPathPaint.setStrokeJoin(Paint.Join.ROUND); mPathPaint.setStrokeCap(Paint.Cap.ROUND); mPathWidth = getResources().getDimensionPixelSize(R.dimen.alp_42447968_lock_pattern_dot_line_width); mPathPaint.setStrokeWidth(mPathWidth); mDotSize = getResources().getDimensionPixelSize(R.dimen.alp_42447968_lock_pattern_dot_size); mDotSizeActivated = getResources() .getDimensionPixelSize(R.dimen.alp_42447968_lock_pattern_dot_size_activated); mPaint.setAntiAlias(true); mPaint.setDither(true); mCellStates = new CellState[MATRIX_WIDTH][MATRIX_WIDTH]; for (int i = 0; i < MATRIX_WIDTH; i++) { for (int j = 0; j < MATRIX_WIDTH; j++) { mCellStates[i][j] = new CellState(); mCellStates[i][j].size = mDotSize; } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !isInEditMode()) { mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in); mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in); } // if }
From source file:org.godotengine.godot.Godot.java
private void initializeGodot() { if (expansion_pack_path != null) { String[] new_cmdline; int cll = 0; if (command_line != null) { new_cmdline = new String[command_line.length + 2]; cll = command_line.length;//from www . j a v a 2 s . co m for (int i = 0; i < command_line.length; i++) { new_cmdline[i] = command_line[i]; } } else { new_cmdline = new String[2]; } new_cmdline[cll] = "--main-pack"; new_cmdline[cll + 1] = expansion_pack_path; command_line = new_cmdline; } io = new GodotIO(this); io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID); GodotLib.io = io; mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME); mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); mSensorManager.registerListener(this, mGravity, SensorManager.SENSOR_DELAY_GAME); mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME); mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE); mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_GAME); GodotLib.initialize(this, getAssets(), use_apk_expansion); result_callback = null; mPaymentsManager = PaymentsManager.createManager(this).initService(); godot_initialized = true; }