From b02bffcfb88ceab5274042c69a51ae36b5114542 Mon Sep 17 00:00:00 2001 From: wjt983049539 Date: Tue, 29 Jun 2021 14:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=89=E5=85=A8=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/tbouron/shakedetector/library/ShakeDetector.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/github/tbouron/shakedetector/library/ShakeDetector.java b/library/src/main/java/com/github/tbouron/shakedetector/library/ShakeDetector.java index bce10cf..a8aaa60 100644 --- a/library/src/main/java/com/github/tbouron/shakedetector/library/ShakeDetector.java +++ b/library/src/main/java/com/github/tbouron/shakedetector/library/ShakeDetector.java @@ -47,6 +47,7 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { private ArrayList mSensorBundles; private Object mLock; private int direction = 1; + long interval = 500l; /** * 上一次检测的时间 */ @@ -165,7 +166,7 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { if (mSensorBundles.size() == 0) { mSensorBundles.add(sensorBundle); } else if (sensorBundle.getTimestamp() - mSensorBundles.get(mSensorBundles.size() - 1) - .getTimestamp() > INTERVAL) { + .getTimestamp() > interval) { mSensorBundles.add(sensorBundle); } } @@ -176,7 +177,7 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { synchronized (mLock) { long currentTime = System.currentTimeMillis(); long diffTime = currentTime - mLastUpdateTime; - if (diffTime < INTERVAL) { + if (diffTime < interval) { return; } mLastUpdateTime = currentTime; @@ -205,7 +206,6 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { } } - // 使用变化的精度 @Override public void onAccuracyDataModified(CategoryOrientation categoryOrientation, int i) { } -- Gitee