diff --git a/entry/build.gradle b/entry/build.gradle index 0155c6c8418cbdf5db21e199c3cbf32700f17b97..60084a7909357bcb2368dd0683e4903ee8e69446 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -21,6 +21,7 @@ dependencies { testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' implementation('com.gitee.chinasoft_ohos:ShakeDetector:0.0.2-SNAPSHOT') +// implementation project(path: ':library') } decc { supportType = ['html', 'xml'] 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 8ec8f99e76f119f532c41ae6752b661a35c21b6b..cd2482db1b70854be41cd2680920de5a236c8079 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 @@ -25,7 +25,10 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { * 默认达标次数 */ public static final int DEFAULT_THRESHOLD_SHAKE_NUMBER = 3; - + /** + * 实际震动强度 + */ + public static float mThresholdAcceleration; /** * 2 */ @@ -37,16 +40,11 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { /** * 默认震动触发次数 */ - + public static int mThresholdShakeNumber; private static CategoryOrientation orientationSensor; private static CategoryOrientationAgent categoryOrientationAgent = new CategoryOrientationAgent(); private static final long INTERVAL = 500L; private static ShakeDetector mSensorEventListener; - public int mThresholdShakeNumber = 3; - /** - * 实际震动强度 - */ - public float mThresholdAcceleration = 1200f; private OnShakeListener mShakeListener; private ArrayList mSensorBundles; @@ -103,6 +101,8 @@ public class ShakeDetector implements ICategoryOrientationDataCallback { mShakeListener = listener; mSensorBundles = new ArrayList(); mLock = new Object(); + mThresholdAcceleration = DEFAULT_THRESHOLD_ACCELERATION; + mThresholdShakeNumber = DEFAULT_THRESHOLD_SHAKE_NUMBER; } /**