From b818e93b524ffb502c286c49ec909cedef137d3c Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Mon, 5 Jul 2021 14:47:44 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/$PROJECT_FILE$ | 11 - .idea/.gitignore | 3 - .idea/checkstyle-idea.xml | 16 - .idea/compiler.xml | 6 - .idea/gradle.xml | 23 -- .idea/jarRepositories.xml | 35 --- .idea/misc.xml | 32 -- .idea/qaplug_profiles.xml | 635 -------------------------------------- .idea/vcs.xml | 6 - 9 files changed, 767 deletions(-) delete mode 100644 .idea/$PROJECT_FILE$ delete mode 100644 .idea/.gitignore delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/jarRepositories.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/qaplug_profiles.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/$PROJECT_FILE$ b/.idea/$PROJECT_FILE$ deleted file mode 100644 index 58b7e3e..0000000 --- a/.idea/$PROJECT_FILE$ +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 6eefe0e..0000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 61a9130..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 842ebc9..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 7552d7c..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 4fc39a5..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml deleted file mode 100644 index ddfa823..0000000 --- a/.idea/qaplug_profiles.xml +++ /dev/null @@ -1,635 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file -- Gitee From fc10f99cc070d0f40dc68f80e85571ab8411812e Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Mon, 5 Jul 2021 17:01:21 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E9=80=82=E9=85=8Dsdk6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++---- README.md | 10 +++++----- build.gradle | 2 +- entry/build.gradle | 2 +- entry/src/main/config.json | 5 ----- turn/build.gradle | 2 +- turn/src/main/config.json | 5 ----- 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b40caa..0a571c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -0.0.1-SNAPSHOT - -ohos 第一个版本 -- 完整实现了原库的全部api +## 0.0.2-SNAPSHOT +ohos 第二个版本,更新sdk6 +## 0.0.1-SNAPSHOT +ohos 第一个版本, +- 实现了原库的全部api - 因为 LayoutManager中方法缺失 原因,修改列表排列方式功能,从自定义LayoutManager 方式改成了自定义ListContainer 方式 diff --git a/README.md b/README.md index bc9e02e..42f78db 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ - 功能:支持四个方向切换,设置半径、偏移量、文字方向等功能 - 项目移植状态:主功能完成 - 调用差异:通过自定义listContainer对外提供调用 -- 开发版本:sdk5,DevEco Studio2.1 Release +- 开发版本:sdk6,DevEco Studio2.2 Beta1 - 基线版本:Release v1.3.1 @@ -27,11 +27,11 @@ allprojects { ``` dependencies { - implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.1-SNAPSHOT' + implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.2-SNAPSHOT' } ``` -在sdk5,DevEco Studio2.1 Release下项目可直接运行,如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 +在sdk6,DevEco Studio2.2 Beta1下项目可直接运行,如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 ## 使用说明 1.布局文件定义 @@ -71,12 +71,12 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +病毒安全检测通过 当前版本demo功能与原组件基本无差异 ## 版本迭代 -- 0.0.1-SNAPSHOT +- 0.0.2-SNAPSHOT ## 版权和许可信息 diff --git a/build.gradle b/build.gradle index d8bca9b..a4bbee5 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.huawei.ohos.app' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/entry/build.gradle b/entry/build.gradle index 64780b4..9faf509 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.huawei.ohos.hap' apply plugin: 'com.huawei.ohos.decctest' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/entry/src/main/config.json b/entry/src/main/config.json index ea40f8b..f6c6ac4 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, diff --git a/turn/build.gradle b/turn/build.gradle index 25ddf0c..7e1e475 100644 --- a/turn/build.gradle +++ b/turn/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.huawei.ohos.library' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/turn/src/main/config.json b/turn/src/main/config.json index 4549f0e..5ee8d4d 100644 --- a/turn/src/main/config.json +++ b/turn/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, -- Gitee From 830ab90f3780f1e07072e0fed1d56462cfe77a71 Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Mon, 5 Jul 2021 18:08:56 +0800 Subject: [PATCH 3/9] =?UTF-8?q?findbug=E6=8A=A5=E5=91=8A=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qaplug_result.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 qaplug_result.html diff --git a/qaplug_result.html b/qaplug_result.html new file mode 100644 index 0000000..245cd12 --- /dev/null +++ b/qaplug_result.html @@ -0,0 +1,12 @@ + + + + +QAPlug scan results + + + +     Project:
          turn-layout-manager
     Scope:
          Project 'turn-layout-manager'
     Profile:
          Default
     Results:
          Enabled coding rules: 346
          Problems found: 0

     Time statistics: +     Detailed Results:
          Empty results

+ + -- Gitee From f098b805fef47273bfff5d77770452cb504f01e3 Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Mon, 5 Jul 2021 18:13:04 +0800 Subject: [PATCH 4/9] =?UTF-8?q?sdk=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qaplug_result.html | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 qaplug_result.html diff --git a/qaplug_result.html b/qaplug_result.html deleted file mode 100644 index 245cd12..0000000 --- a/qaplug_result.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - -QAPlug scan results - - - -     Project:
          turn-layout-manager
     Scope:
          Project 'turn-layout-manager'
     Profile:
          Default
     Results:
          Enabled coding rules: 346
          Problems found: 0

     Time statistics: -     Detailed Results:
          Empty results

- - -- Gitee From a38dc92c0a919069d3a9235454c48ea340fb98c0 Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Tue, 6 Jul 2021 10:29:01 +0800 Subject: [PATCH 5/9] =?UTF-8?q?sdk=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entry/build.gradle b/entry/build.gradle index 9faf509..8d65c07 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -20,7 +20,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' - implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.1-SNAPSHOT' + implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.2-SNAPSHOT' } decc { supportType = ['html', 'xml'] -- Gitee From 81477472f3fafd28befdb444bfed9f4af3cc493f Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Tue, 6 Jul 2021 10:29:47 +0800 Subject: [PATCH 6/9] =?UTF-8?q?sdk=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a571c6..959c077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,4 +3,4 @@ ohos 第二个版本,更新sdk6 ## 0.0.1-SNAPSHOT ohos 第一个版本, - 实现了原库的全部api -- 因为 LayoutManager中方法缺失 原因,修改列表排列方式功能,从自定义LayoutManager 方式改成了自定义ListContainer 方式 +- 因为LayoutManager中方法缺失,修改列表排列方式功能,从自定义LayoutManager 方式改成了自定义ListContainer 方式 -- Gitee From c6376448ffc04a08c9f603d2c487bc0398e36cd2 Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Tue, 6 Jul 2021 14:31:52 +0800 Subject: [PATCH 7/9] =?UTF-8?q?findbugs=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build.gradle | 3 ++- .../turn_layout_manager/BigDecimalUtils.java | 10 +++++----- .../ohos/library/turn/TurnListContainer.java | 14 +++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/entry/build.gradle b/entry/build.gradle index 8d65c07..ec9f968 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -20,7 +20,8 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' - implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.2-SNAPSHOT' + implementation project(path: ':turn') + //implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.2-SNAPSHOT' } decc { supportType = ['html', 'xml'] diff --git a/entry/src/main/java/com/example/turn_layout_manager/BigDecimalUtils.java b/entry/src/main/java/com/example/turn_layout_manager/BigDecimalUtils.java index bc7786a..aa52f63 100644 --- a/entry/src/main/java/com/example/turn_layout_manager/BigDecimalUtils.java +++ b/entry/src/main/java/com/example/turn_layout_manager/BigDecimalUtils.java @@ -76,7 +76,7 @@ public final class BigDecimalUtils { * @param v2 除数 * @return 两个参数的商 */ - public static double div(double v1, double v2) { + public static double div(float v1, float v2) { return div(v1, v2, DEF_DIV_SCALE); } @@ -89,7 +89,7 @@ public final class BigDecimalUtils { * @param scale 表示表示需要精确到小数点以后几位。 * @return 两个参数的商 */ - public static double div(double v1, double v2, int scale) { + public static double div(float v1, float v2, int scale) { int mScale; mScale = scale; if (scale < 0) { @@ -97,7 +97,7 @@ public final class BigDecimalUtils { } BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.divide(b2, mScale, BigDecimal.ROUND_HALF_UP).doubleValue(); + return b1.divide(b2, mScale, BigDecimal.ROUND_HALF_UP).floatValue(); } /** @@ -107,7 +107,7 @@ public final class BigDecimalUtils { * @param scale 小数点后保留几位 * @return 四舍五入后的结果 */ - public static double round(double val, int scale) { + public static double round(float val, int scale) { int mScale; mScale = scale; if (scale < 0) { @@ -115,6 +115,6 @@ public final class BigDecimalUtils { } BigDecimal bd = new BigDecimal(Double.toString(val)); BigDecimal one = new BigDecimal("1"); - return bd.divide(one, mScale, BigDecimal.ROUND_HALF_UP).doubleValue(); + return bd.divide(one, mScale, BigDecimal.ROUND_HALF_UP).floatValue(); } } diff --git a/turn/src/main/java/com/cdflynn/ohos/library/turn/TurnListContainer.java b/turn/src/main/java/com/cdflynn/ohos/library/turn/TurnListContainer.java index a92ce32..bb304ab 100644 --- a/turn/src/main/java/com/cdflynn/ohos/library/turn/TurnListContainer.java +++ b/turn/src/main/java/com/cdflynn/ohos/library/turn/TurnListContainer.java @@ -281,7 +281,7 @@ public class TurnListContainer extends ListContainer implements ListContainer.Sc child.setRotation(0); return; } - boolean childPastCenter = (DecimalUtils.div(child.getContentPositionY(), + boolean childPastCenter = (DecimalUtils.add(child.getContentPositionY(), child.getHeight() / PART)) > center1.getPointY(); float directionMult; if (gravit == Gravity.END) { @@ -289,7 +289,8 @@ public class TurnListContainer extends ListContainer implements ListContainer.Sc } else { directionMult = childPastCenter ? 1 : COEFFICIENT; } - final float opposite = Math.abs(child.getContentPositionY() + child.getHeight() / PART - center1.getPointY()); + final float opposite = Math.abs(DecimalUtils.sub(DecimalUtils.sub(child.getContentPositionY(), + child.getHeight() / PART), center1.getPointY())); child.setRotation((float) (directionMult * Math.toDegrees(Math.asin(opposite / radius1)))); } @@ -303,7 +304,8 @@ public class TurnListContainer extends ListContainer implements ListContainer.Sc continue; } LayoutConfig layoutParams = child.getLayoutConfig(); - final int offsetY = (int) resolveOffsetY(radius, child.getContentPositionX() + child.getWidth() / PART, + final int offsetY = (int) resolveOffsetY(radius, DecimalUtils.add(child.getContentPositionX(), + child.getWidth() / PART), center, peekDistance); final int yy = gravity == Gravity.START ? offsetY + getMarginStart(layoutParams) : getHeight() - offsetY - child.getHeight() - getMarginStart(layoutParams); @@ -325,14 +327,16 @@ public class TurnListContainer extends ListContainer implements ListContainer.Sc child.setRotation(0); return; } - boolean childPastCenter = (child.getContentPositionX() + child.getWidth() / HALF) > center1.getPointX(); + boolean childPastCenter = (DecimalUtils.add(child.getContentPositionX(), + (float) child.getWidth() / HALF)) > center1.getPointX(); float directionMult; if (gravit == Gravity.END) { directionMult = childPastCenter ? 1 : COEFFICIENT; } else { directionMult = childPastCenter ? COEFFICIENT : 1; } - final float opposite = Math.abs(child.getContentPositionX() + child.getWidth() / HALF - center1.getPointX()); + final float opposite = Math.abs(DecimalUtils.sub(DecimalUtils.add(child.getContentPositionX(), + (float) child.getWidth() / HALF), center1.getPointX())); child.setRotation((float) (directionMult * Math.toDegrees(Math.asin(opposite / radius1)))); } -- Gitee From 76dfa020d68f3f52d88eb9bc75790dc7ea7e9521 Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Tue, 6 Jul 2021 14:34:16 +0800 Subject: [PATCH 8/9] =?UTF-8?q?findbugs=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/entry/build.gradle b/entry/build.gradle index ec9f968..8d65c07 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -20,8 +20,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' - implementation project(path: ':turn') - //implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.2-SNAPSHOT' + implementation 'com.gitee.chinasoft_ohos:turnLayoutManager:0.0.2-SNAPSHOT' } decc { supportType = ['html', 'xml'] -- Gitee From 8ab7ad30eb583f9565cc71a96b28333d7973ca27 Mon Sep 17 00:00:00 2001 From: 258767-shengyu <1qaz2wsx> Date: Tue, 6 Jul 2021 15:24:19 +0800 Subject: [PATCH 9/9] =?UTF-8?q?findbugs=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/entry/build.gradle b/entry/build.gradle index 8d65c07..800c206 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:turnLayoutManager:0.0.2-SNAPSHOT' + //implementation project(path: ':turn') } decc { supportType = ['html', 'xml'] -- Gitee