From 82676a6916aac078f53fa67e04944ecafa510679 Mon Sep 17 00:00:00 2001 From: TFStudy <3202410880@qq.com> Date: Tue, 6 Jul 2021 09:41:17 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=89=88=E6=9C=AC=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- example/build.gradle | 2 +- example/src/main/config.json | 8 ++------ pinview/build.gradle | 2 +- pinview/src/main/config.json | 5 ----- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 5e5cfbe..60ddac9 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/example/build.gradle b/example/build.gradle index 642c86d..d6a0bc5 100644 --- a/example/build.gradle +++ b/example/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/example/src/main/config.json b/example/src/main/config.json index 672e31e..b5f3b6a 100644 --- a/example/src/main/config.json +++ b/example/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, @@ -22,7 +17,8 @@ "distro": { "deliveryWithInstall": true, "moduleName": "example", - "moduleType": "entry" + "moduleType": "entry", + "installationFree":false }, "abilities": [ { diff --git a/pinview/build.gradle b/pinview/build.gradle index 76741ae..b9b04bc 100644 --- a/pinview/build.gradle +++ b/pinview/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.huawei.ohos.library' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/pinview/src/main/config.json b/pinview/src/main/config.json index c843cf4..c4e7e0b 100644 --- a/pinview/src/main/config.json +++ b/pinview/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, -- Gitee From 5576bfefe06b467e825126eace7e5117dbd4d35a Mon Sep 17 00:00:00 2001 From: TFStudy <3202410880@qq.com> Date: Tue, 6 Jul 2021 09:42:13 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=89=88=E6=9C=AC=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee81af3..4a10cd8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - 项目移植状态:TextField光标设置图片背景未实现 - 调用差异:无 - 基线版本:Release v1.4 -- 开发版本:sdk5,DevEco Studio 2.1 Release +- 开发版本:sdk6,DevEco Studio 2.2 Beta1 #### 效果演示 @@ -34,7 +34,7 @@ allprojects { ...... } ``` -在sdk5,DevEco Studio 2.1 Release下项目可直接运行 +在sdk6,DevEco Studio 2.2 Beta1 下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 -- Gitee From 8e701f6712076a2aa9b6cd0ec02442aacb0da55e Mon Sep 17 00:00:00 2001 From: TFStudy <3202410880@qq.com> Date: Tue, 6 Jul 2021 15:17:03 +0800 Subject: [PATCH 3/5] =?UTF-8?q?findBugs=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/goodiebag/pinview/MyValue.java | 76 +++++++++++++++++-- .../java/com/goodiebag/pinview/Pinview.java | 73 +++++++++--------- 2 files changed, 109 insertions(+), 40 deletions(-) diff --git a/pinview/src/main/java/com/goodiebag/pinview/MyValue.java b/pinview/src/main/java/com/goodiebag/pinview/MyValue.java index 2a522b3..ed2f945 100644 --- a/pinview/src/main/java/com/goodiebag/pinview/MyValue.java +++ b/pinview/src/main/java/com/goodiebag/pinview/MyValue.java @@ -24,21 +24,87 @@ public class MyValue { /** * 所有子视图 */ - public static List pinviews = new ArrayList<>(); + private static List pinviews = new ArrayList<>(); /** * 所有输入框 */ - public static List fields = new ArrayList<>(); + private static List fields = new ArrayList<>(); /** * 位置 */ - public static int size = 0; + private static int size = 0; /** * 行数 */ - public static int page = 0; + private static int page = 0; /** * 存储临时输入框 */ - public static TextField temp = null; + private static TextField temp = null; + + /*** + * getPinviews + * + * @return List + */ + public static List getPinviews() { + return pinviews; + } + + /*** + * getFields + * + * @return List + */ + public static List getFields() { + return fields; + } + + /*** + * getSize + * + * @return int + */ + public static int getSize() { + return size; + } + + /*** + * setSize + */ + public static void setSize(int size) { + MyValue.size = size; + } + + /*** + * getPage + * + * @return int + */ + public static int getPage() { + return page; + } + + /*** + * setPage + */ + public static void setPage(int page) { + MyValue.page = page; + } + + /*** + * getTemp + * + * @return TextField + */ + public static TextField getTemp() { + return temp; + } + + /*** + * setTemp + */ + public static void setTemp(TextField temp) { + MyValue.temp = temp; + } } diff --git a/pinview/src/main/java/com/goodiebag/pinview/Pinview.java b/pinview/src/main/java/com/goodiebag/pinview/Pinview.java index c30ec2e..e5a99eb 100644 --- a/pinview/src/main/java/com/goodiebag/pinview/Pinview.java +++ b/pinview/src/main/java/com/goodiebag/pinview/Pinview.java @@ -70,6 +70,7 @@ public class Pinview extends DirectionalLayout implements private int count = 0; private int number = 0; private boolean isDeleteOk = false; + private int size; /** * 构造 @@ -107,46 +108,48 @@ public class Pinview extends DirectionalLayout implements @Override public void onClick(Component component) { - if (MyValue.temp != null && MyValue.temp != component) { - if (MyValue.page == 4) { - selectFlag(MyValue.temp, 3); + if (MyValue.getTemp() != null && MyValue.getTemp() != component) { + if (MyValue.getPage() == 4) { + selectFlag(MyValue.getTemp(), 3); } else { - selectFlag(MyValue.temp, 2); + selectFlag(MyValue.getTemp(), 2); } - MyValue.temp.clearFocus(); + MyValue.getTemp().clearFocus(); } - MyValue.pinviews.clear(); - MyValue.fields.clear(); + MyValue.getPinviews().clear(); + MyValue.getFields().clear(); for (int index = 0; index < ((DirectionalLayout) getComponentParent()).getChildCount(); index++) { if (((DirectionalLayout) getComponentParent()).getComponentAt(index) instanceof Pinview) { - MyValue.pinviews.add((Pinview) ((DirectionalLayout) getComponentParent()).getComponentAt(index)); + MyValue.getPinviews().add((Pinview) ((DirectionalLayout) getComponentParent()).getComponentAt(index)); } } - for (int pinIndex = 0; pinIndex < MyValue.pinviews.size(); pinIndex++) { - Pinview pinView = MyValue.pinviews.get(pinIndex); + for (int pinIndex = 0; pinIndex < MyValue.getPinviews().size(); pinIndex++) { + Pinview pinView = MyValue.getPinviews().get(pinIndex); for (int index = 0; index < pinView.getChildCount(); index++) { - MyValue.fields.add((TextField) pinView.getComponentAt(index)); + MyValue.getFields().add((TextField) pinView.getComponentAt(index)); } } - if (MyValue.fields.size() > 0) { - for (TextField field : MyValue.fields) { - MyValue.size++; + if (MyValue.getFields().size() > 0) { + for (TextField field : MyValue.getFields()) { + size = MyValue.getSize(); + size++; + MyValue.setSize(size); if (field == component) { break; } } } - if (MyValue.size >= 0 && MyValue.size <= mPinLength - 1) { - MyValue.page = 0; - } else if (MyValue.size > mPinLength - 1 && MyValue.size <= mPinLength * 2 - 1) { - MyValue.page = 1; - } else if (MyValue.size > mPinLength * 2 - 1 && MyValue.size <= mPinLength * 3 - 1) { - MyValue.page = 2; - } else if (MyValue.size > mPinLength * 2 - 1 && MyValue.size <= mPinLength * 4 - 1) { - MyValue.page = 3; + if (MyValue.getSize() >= 0 && MyValue.getSize() <= mPinLength - 1) { + MyValue.setPage(0); + } else if (MyValue.getSize() > mPinLength - 1 && MyValue.getSize() <= mPinLength * 2 - 1) { + MyValue.setPage(1); + } else if (MyValue.getSize() > mPinLength * 2 - 1 && MyValue.getSize() <= mPinLength * 3 - 1) { + MyValue.setPage(2); + } else if (MyValue.getSize() > mPinLength * 3 - 1 && MyValue.getSize() <= mPinLength * 4 - 1) { + MyValue.setPage(3); } - MyValue.size = 0; + MyValue.setSize(0); if (!isCursorVisible) { for (int i = 0; i < Integer.parseInt(component.getTag().toString()); i++) { TextField textField = textFields.get(i); @@ -521,27 +524,27 @@ public class Pinview extends DirectionalLayout implements } } } - return false; + return true; } else if (keyEvent.isKeyDown() && keyEvent.getKeyCode() == KeyEvent.KEY_ENTER) { - if (MyValue.page == 0) { + if (MyValue.getPage() == 0) { enter(1); - MyValue.page = 1; - } else if (MyValue.page == 1) { + MyValue.setPage(1); + } else if (MyValue.getPage() == 1) { enter(2); - MyValue.page = 2; - } else if (MyValue.page == 2) { + MyValue.setPage(2); + } else if (MyValue.getPage() == 2) { enter(3); - MyValue.page = 3; - } else if (MyValue.page == 3) { + MyValue.setPage(3); + } else if (MyValue.getPage() == 3) { enter(4); - MyValue.page = 4; + MyValue.setPage(4); } } - return false; + return true; } private void enter(int page) { - Pinview pinview = MyValue.pinviews.get(page); + Pinview pinview = MyValue.getPinviews().get(page); int childCount = pinview.getChildCount(); for (int index = 0; index < childCount; index++) { TextField field = (TextField) pinview.getComponentAt(index); @@ -561,7 +564,7 @@ public class Pinview extends DirectionalLayout implements selectFlag(textField, 0); } } - MyValue.temp = field; + MyValue.setTemp(field); field.setFocusable(FOCUS_ENABLE); field.setEnabled(true); field.requestFocus(); -- Gitee From fbc1cf4450307f013bf7bd839fb33ef8f1c5ff51 Mon Sep 17 00:00:00 2001 From: TFStudy <3202410880@qq.com> Date: Tue, 6 Jul 2021 19:41:33 +0800 Subject: [PATCH 4/5] =?UTF-8?q?findBugs=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ README.md | 2 +- build.gradle | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5180bf..5a2fb27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.0.2-SNAPSHOT +* 修改FindBugs + ## 0.0.1-SNAPSHOT ohos第一个版本 * 实现了原库的大部分api diff --git a/README.md b/README.md index 4a10cd8..dd18284 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ allprojects { 2.在entry模块的build.gradle文件中 ```gradle dependencies { - implementation('com.gitee.chinasoft_ohos:Pinview:0.0.1-SNAPSHOT') + implementation('com.gitee.chinasoft_ohos:Pinview:0.0.2-SNAPSHOT') ...... } ``` diff --git a/build.gradle b/build.gradle index 60ddac9..f0c73f7 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.4.2' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } -- Gitee From a50b47430a132a8ff1c60d1284e47448d8015bfe Mon Sep 17 00:00:00 2001 From: TFStudy <3202410880@qq.com> Date: Wed, 7 Jul 2021 14:15:16 +0800 Subject: [PATCH 5/5] =?UTF-8?q?findBugs=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd18284..597a74f 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ CloudTest代码测试无异常 - 0.0.1-SNAPSHOT #### 版权和许可信息 -- ``` + ``` MIT License Copyright (c) 2017 GoodieBag -- Gitee