diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae78c113ffe1ce77dc1e8b7339ce5ca70cc215db --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,113 @@ + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..db2036477785f90c6a0441168edc8948555bbed2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000000000000000000000000000000000000..d291b3d7cd3a8660a2272f65ddbfa731bd1daa61 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..37a750962da6f2b31810e85c8acae1081de7f58c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f68460d8b38ac04e3a3224d7c79ef719b1991a9 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 249cb4c84bf54fb98e7099b13a4ff74122b9ca9f..3c81405169ee48bf2bce7f7e8fc607db6acb7733 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,11 +33,11 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - implementation 'androidx.annotation:annotation:1.0.0' + implementation 'androidx.multidex:multidex:2.0.0' implementation 'androidx.appcompat:appcompat:1.0.0' - implementation rootProject.ext.dependencies["lib_calculation"] +// implementation rootProject.ext.dependencies["lib_calculation"] //临时 implementation 'com.google.code.gson:gson:2.8.5' diff --git a/app/src/main/java/com/leiguoqiang/handwriting/model/CalculateModel.java b/app/src/main/java/com/leiguoqiang/handwriting/model/CalculateModel.java index ecbd51d62ac36c57261e471d0542f0cd2b6cb5db..c5dccfafea0a24a27b4d928903cc9b67d501c3ac 100644 --- a/app/src/main/java/com/leiguoqiang/handwriting/model/CalculateModel.java +++ b/app/src/main/java/com/leiguoqiang/handwriting/model/CalculateModel.java @@ -2,7 +2,6 @@ package com.leiguoqiang.handwriting.model; import android.util.Log; -import com.dosmono.device.KeyImpl; import com.leiguoqiang.handwriting.entity.PointBean; import java.math.BigDecimal; @@ -15,61 +14,61 @@ import java.math.BigDecimal; public class CalculateModel { public static float add(float a, float b) { -// float result = new BigDecimal(a).add(new BigDecimal(b)).floatValue(); -// return Float.isNaN(result) ? 0.0f : result; - - float result = KeyImpl.add(a, b); + float result = new BigDecimal(a).add(new BigDecimal(b)).floatValue(); return Float.isNaN(result) ? 0.0f : result; - } - public static float subtraction(float a, float b) { -// float result = new BigDecimal(a).subtract(new BigDecimal(b)).floatValue(); +// float result = KeyImpl.add(a, b); // return Float.isNaN(result) ? 0.0f : result; + } - float result = KeyImpl.subtraction(a, b); + public static float subtraction(float a, float b) { + float result = new BigDecimal(a).subtract(new BigDecimal(b)).floatValue(); return Float.isNaN(result) ? 0.0f : result; + +// float result = KeyImpl.subtraction(a, b); +// return Float.isNaN(result) ? 0.0f : result; } public static float subtraction(long a, long b) { -// float result = new BigDecimal(a).subtract(new BigDecimal(b)).longValue(); -// return Float.isNaN(result) ? 0.0f : result; -// - float result = KeyImpl.subtraction(a, b); + float result = new BigDecimal(a).subtract(new BigDecimal(b)).longValue(); return Float.isNaN(result) ? 0.0f : result; +// +// float result = KeyImpl.subtraction(a, b); +// return Float.isNaN(result) ? 0.0f : result; } public static float multiple(float a, float b) { -// float result = new BigDecimal(a).multiply(new BigDecimal(b)).floatValue(); -// return Float.isNaN(result) ? 0.0f : result; -// - float result = KeyImpl.multiple(a, b); + float result = new BigDecimal(a).multiply(new BigDecimal(b)).floatValue(); return Float.isNaN(result) ? 0.0f : result; +// +// float result = KeyImpl.multiple(a, b); +// return Float.isNaN(result) ? 0.0f : result; } public static float divider(float a, float b) { -// float result = 0.0f; -// try { -// result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).floatValue(); -// } catch (Exception e) { -// Log.i("handwriting_module:", "除法错误"); -// } -// return Float.isNaN(result) ? 0.0f : result; -// - float result = KeyImpl.divider(a, b); + float result = 0.0f; + try { + result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).floatValue(); + } catch (Exception e) { + Log.i("handwriting_module:", "除法错误"); + } return Float.isNaN(result) ? 0.0f : result; + +// float result = KeyImpl.divider(a, b); +// return Float.isNaN(result) ? 0.0f : result; } public static float divider(long a, long b) { -// float result = 0; -// try { -// result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).longValue(); -// } catch (Exception e) { -// Log.i("handwriting_module:", "除法错误"); -// } -// return Float.isNaN(result) ? 0.0f : result; -// - float result = KeyImpl.divider(a, b); + float result = 0; + try { + result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).longValue(); + } catch (Exception e) { + Log.i("handwriting_module:", "除法错误"); + } return Float.isNaN(result) ? 0.0f : result; + +// float result = KeyImpl.divider(a, b); +// return Float.isNaN(result) ? 0.0f : result; } /** diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..f6b961fd5a86aa5fbfe90f707c3138408be7c718 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..3e2d22df988fc3191bfe6dfcb462e2831df38a76 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Feb 17 14:16:59 CST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip