Sensey { public void startOrientationDetection(OrientationListener orientationListener) { startLibrarySensorDetection(new OrientationDetector(orientationListener), orientationListener); } private  Sensey(); static Sensey getInstance(); void init(Context context, int samplingPeriod); void init(Context context); void setupDispatchTouchEvent(MotionEvent event); void startChopDetection(ChopListener chopListener); void startChopDetection(float threshold, long timeForChopGesture,
            ChopListener chopListener); void startFlipDetection(FlipListener flipListener); void startLightDetection(LightListener lightListener); void startLightDetection(float threshold, LightListener lightListener); void startMovementDetection(MovementListener movementListener); void startMovementDetection(float threshold, long timeBeforeDeclaringStationary,
            MovementListener movementListener); void startOrientationDetection(OrientationListener orientationListener); void startOrientationDetection(int smoothness, OrientationListener orientationListener); void startPickupDeviceDetection(PickupDeviceListener pickupDeviceListener); void startPinchScaleDetection(Context context, PinchScaleListener pinchScaleListener); void startProximityDetection(ProximityListener proximityListener); void startRotationAngleDetection(RotationAngleListener rotationAngleListener); void startScoopDetection(ScoopListener scoopListener); void startScoopDetection(float threshold, ScoopListener scoopListener); void startShakeDetection(ShakeListener shakeListener); void startShakeDetection(float threshold, long timeBeforeDeclaringShakeStopped,
            ShakeListener shakeListener); @RequiresPermission(Manifest.permission.RECORD_AUDIO) void startSoundLevelDetection(Context context, SoundLevelListener soundLevelListener); void startStepDetection(Context context, StepListener stepListener, int gender); void startTiltDirectionDetection(TiltDirectionListener tiltDirectionListener); void startTouchTypeDetection(Context context, TouchTypListener touchTypListener); void startWaveDetection(WaveListener waveListener); void startWaveDetection(float threshold, WaveListener waveListener); void startWristTwistDetection(WristTwistListener wristTwistListener); void startWristTwistDetection(float threshold, long timeForWristTwistGesture,
            WristTwistListener wristTwistListener); void stop(); void stopChopDetection(ChopListener chopListener); void stopFlipDetection(FlipListener flipListener); void stopLightDetection(LightListener lightListener); void stopMovementDetection(MovementListener movementListener); void stopOrientationDetection(OrientationListener orientationListener); void stopPickupDeviceDetection(PickupDeviceListener pickupDeviceListener); void stopPinchScaleDetection(); void stopProximityDetection(ProximityListener proximityListener); void stopRotationAngleDetection(RotationAngleListener rotationAngleListener); void stopScoopDetection(ScoopListener scoopListener); void stopShakeDetection(ShakeListener shakeListener); void stopSoundLevelDetection(); void stopStepDetection(StepListener stepListener); void stopTiltDirectionDetection(TiltDirectionListener tiltDirectionListener); void stopTouchTypeDetection(); void stopWaveDetection(WaveListener waveListener); void stopWristTwistDetection(WristTwistListener wristTwistListener); static final int SAMPLING_PERIOD_FASTEST; static final int SAMPLING_PERIOD_GAME; static final int SAMPLING_PERIOD_NORMAL; static final int SAMPLING_PERIOD_UI; }
@Test public void detectListenerWithStartOrientationDetection() { addSensor(TYPE_ACCELEROMETER); addSensor(TYPE_MAGNETIC_FIELD); OrientationListener fakeListener = mock(OrientationListener.class); sensey.startOrientationDetection(fakeListener); OrientationDetector detector = getDetector(fakeListener, OrientationDetector.class); if (detector != null) { assertTrue("Sensor Manager must contain sensor event listener for orientation", shadowSensorManager.hasListener(detector)); } else { fail( "There should be orientation detector in sensey. If not, please, check last version of class and update reflection accessing to it field"); } }
@Test public void detectListenerWithStartOrientationDetectionWithCustomSmoothness() { addSensor(TYPE_ACCELEROMETER); addSensor(TYPE_MAGNETIC_FIELD); OrientationListener fakeListener = mock(OrientationListener.class); sensey.startOrientationDetection(3, fakeListener); OrientationDetector detector = getDetector(fakeListener, OrientationDetector.class); if (detector != null) { assertTrue("Sensor Manager must contain sensor event listener for orientation", shadowSensorManager.hasListener(detector)); } else { fail( "There should be orientation detector in sensey. If not, please, check last version of class and update reflection accessing to it field"); } }