diff --git a/CHANGELOG.md b/CHANGELOG.md index 12b33244dd31c14a62b30170cc010c6133ed0b75..c78ab15c82ed9a10172e76bf3ee7aa6cfc51609a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ -## 0.0.2-SNAPSHOT +## 0.0.3-SNAPSHOT +ohos 第3个版本 + * 代码优化 +## 0.0.2-SNAPSHOT ohos 第2个版本 * 更新sdk6 ## 0.0.1-SNAPSHOT ohos 第1个版本 - * 实现了原库的全部ap \ No newline at end of file + * 实现了原库的全部api \ No newline at end of file diff --git a/README.md b/README.md index 0143cfea26d668056058691faafd0a21b14dab31..8b049afec7ae8761cd6282bbdf758449fc795678 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ ``` dependencies { - implementation('com.gitee.chinasoft_ohos:ExplosionField:0.0.2-SNAPSHOT') + implementation('com.gitee.chinasoft_ohos:ExplosionField:0.0.3-SNAPSHOT') ...... } ``` @@ -58,7 +58,7 @@ CloudTest代码测试无异常 ## 版本迭代 -- 0.0.2-SNAPSHOT +- 0.0.3-SNAPSHOT ## 版本和许可信息 diff --git a/entry/build.gradle b/entry/build.gradle index 496a168e9e6704beb8a1896bbcfe25b3ff1ccff7..7db2b233b6a953563f0cc72d8c2d1454f2b1f97e 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -19,8 +19,9 @@ 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:ExplosionField:0.0.2-SNAPSHOT') + implementation('com.gitee.chinasoft_ohos:ExplosionField:0.0.3-SNAPSHOT') +// implementation project(path : ":explosionfield") } decc { supportType = ['html', 'xml'] -} +} \ No newline at end of file diff --git a/entry/src/main/java/com/tyrantgit/sample/MainAbility.java b/entry/src/main/java/com/tyrantgit/sample/MainAbility.java index c872f9c812d81fc9ea562f4543380f99322ce203..a9630abfee724b4a5216d90b4de5d88df9cff682 100644 --- a/entry/src/main/java/com/tyrantgit/sample/MainAbility.java +++ b/entry/src/main/java/com/tyrantgit/sample/MainAbility.java @@ -2,7 +2,7 @@ * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. - * You may obtain an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,12 +14,17 @@ */ package com.tyrantgit.sample; + import com.tyrantgit.sample.slice.MainAbilitySlice; import ohos.aafwk.ability.Ability; import ohos.aafwk.content.Intent; +/** + * MainAbility + * + * @since 2021-04-06 + */ public class MainAbility extends Ability { - @Override public void onStart(Intent intent) { super.onStart(intent); diff --git a/entry/src/main/java/com/tyrantgit/sample/MyApplication.java b/entry/src/main/java/com/tyrantgit/sample/MyApplication.java index 737d81d8400d5d88c19d4bab35705b2b56b8d8aa..f5b3e36bd387e6d3a8e8c3fec461b41304c94c94 100644 --- a/entry/src/main/java/com/tyrantgit/sample/MyApplication.java +++ b/entry/src/main/java/com/tyrantgit/sample/MyApplication.java @@ -2,7 +2,7 @@ * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. - * You may obtain an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -17,6 +17,11 @@ package com.tyrantgit.sample; import ohos.aafwk.ability.AbilityPackage; +/** + * MyApplication + * + * @since 2021-04-06 + */ public class MyApplication extends AbilityPackage { @Override public void onInitialize() { diff --git a/entry/src/main/java/com/tyrantgit/sample/slice/MainAbilitySlice.java b/entry/src/main/java/com/tyrantgit/sample/slice/MainAbilitySlice.java index d611d367e263500b0525485252d13ff1bdc8a5b1..31b969d16f5ee278494c608ca61745572a4a5dd3 100644 --- a/entry/src/main/java/com/tyrantgit/sample/slice/MainAbilitySlice.java +++ b/entry/src/main/java/com/tyrantgit/sample/slice/MainAbilitySlice.java @@ -2,7 +2,7 @@ * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. - * You may obtain an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,11 +14,17 @@ */ package com.tyrantgit.sample.slice; + import com.tyrantgit.explosionfield.ExplosionField; import com.tyrantgit.sample.ResourceTable; import ohos.aafwk.ability.AbilitySlice; import ohos.aafwk.content.Intent; -import ohos.agp.components.*; +import ohos.agp.components.AttrHelper; +import ohos.agp.components.Component; +import ohos.agp.components.DirectionalLayout; +import ohos.agp.components.Image; +import ohos.agp.components.LayoutScatter; +import ohos.agp.components.Text; import ohos.agp.components.element.ShapeElement; import ohos.agp.utils.LayoutAlignment; import ohos.agp.window.dialog.PopupDialog; @@ -37,10 +43,14 @@ import java.util.Optional; * @since 2021-04-08 */ public class MainAbilitySlice extends AbilitySlice implements Component.TouchEventListener { + private final int num2 = 2; + private final int num4 = 4; + private final int num10 = 10; + private final int num130 = 130; private ExplosionField mExplosionField; private List components; private int[] ids = {ResourceTable.Id_image1, ResourceTable.Id_image2, ResourceTable.Id_image3, - ResourceTable.Id_image4, ResourceTable.Id_image5, ResourceTable.Id_image6, ResourceTable.Id_text }; + ResourceTable.Id_image4, ResourceTable.Id_image5, ResourceTable.Id_image6, ResourceTable.Id_text }; private Image undoBtn; /** @@ -66,23 +76,23 @@ public class MainAbilitySlice extends AbilitySlice implements Component.TouchEve undoBtn.setClickedListener(new Component.ClickedListener() { @Override public void onClick(Component component) { - Optional - display = DisplayManager.getInstance().getDefaultDisplay(getContext()); - DisplayAttributes displayAttributes = display.get().getAttributes(); - PopupDialog menuDialog = new PopupDialog(getContext(), null); DirectionalLayout menuComponent = (DirectionalLayout) LayoutScatter.getInstance(getContext()) .parse(ResourceTable.Layout_custom_setting_popup, null, false); Text textSetting = (Text) menuComponent.findComponentById(ResourceTable.Id_text); DirectionalLayout dl = (DirectionalLayout) menuComponent.findComponentById(ResourceTable.Id_dl); - textSetting.setWidth(getWindow().getLayoutConfig().get().width / 2); + textSetting.setWidth(getWindow().getLayoutConfig().get().width / num2); ShapeElement element = new ShapeElement(); - element.setCornerRadius(10); + element.setCornerRadius(num10); dl.setBackground(element); textSetting.setBackground(element); - menuDialog.setCornerRadius(10); - + Optional display = DisplayManager.getInstance().getDefaultDisplay(getContext()); + DisplayAttributes displayAttributes = display.get().getAttributes(); + PopupDialog menuDialog = new PopupDialog(getContext(), null); + menuDialog.setCornerRadius(num10); menuDialog.setCustomComponent(menuComponent); - menuDialog.showOnCertainPosition(1, displayAttributes.width / 4 - AttrHelper.vp2px(10, getContext()), -displayAttributes.width + 130); + menuDialog.showOnCertainPosition(1, + displayAttributes.width / num4 - AttrHelper.vp2px(num10, getContext()), + -displayAttributes.width + num130); menuDialog.setAutoClosable(true); menuDialog.setAlignment(LayoutAlignment.RIGHT | LayoutAlignment.TOP); menuDialog.show(); diff --git a/entry/src/ohosTest/java/com/tyrantgit/sample/ExampleOhosTest.java b/entry/src/ohosTest/java/com/tyrantgit/sample/ExampleOhosTest.java index 9e9a250c58b14f6a362268c77a721efa9cf0af49..f3212a4b9d9a7f81efe5599ef2c5eae477b539bb 100644 --- a/entry/src/ohosTest/java/com/tyrantgit/sample/ExampleOhosTest.java +++ b/entry/src/ohosTest/java/com/tyrantgit/sample/ExampleOhosTest.java @@ -2,7 +2,7 @@ * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. - * You may obtain an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * diff --git a/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionAnimator.java b/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionAnimator.java index a13ee91b9205bf2bff810ab69f22ce015c8993c3..5520224987f1e384d2fcdae16b75c122f7d9c9db 100644 --- a/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionAnimator.java +++ b/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionAnimator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.tyrantgit.explosionfield; import com.tyrantgit.explosionfield.util.AnimatorValueUtil; diff --git a/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionField.java b/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionField.java index 753235b1844d07606d0daa8e3941d19c36716d07..ac5225a41ca81cf592b51f8dfd5d1fdd596dc3f4 100644 --- a/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionField.java +++ b/explosionfield/src/main/java/com/tyrantgit/explosionfield/ExplosionField.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.tyrantgit.explosionfield; import ohos.aafwk.ability.Ability; diff --git a/explosionfield/src/main/java/com/tyrantgit/explosionfield/Utils.java b/explosionfield/src/main/java/com/tyrantgit/explosionfield/Utils.java index ef95a623d30e8f4e5ed65aaf2b8d9ecf5818eafc..16b73504942b527ba914e6119ab4218005eb7cfd 100644 --- a/explosionfield/src/main/java/com/tyrantgit/explosionfield/Utils.java +++ b/explosionfield/src/main/java/com/tyrantgit/explosionfield/Utils.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.tyrantgit.explosionfield; import ohos.agp.components.Component; diff --git a/explosionfield/src/main/java/com/tyrantgit/explosionfield/util/AnimatorValueUtil.java b/explosionfield/src/main/java/com/tyrantgit/explosionfield/util/AnimatorValueUtil.java index d853cfa34d24268797f3c1f4fc51f50621017e80..dfb8d1ddb39789b4eeefaf6623dade8c5058b801 100644 --- a/explosionfield/src/main/java/com/tyrantgit/explosionfield/util/AnimatorValueUtil.java +++ b/explosionfield/src/main/java/com/tyrantgit/explosionfield/util/AnimatorValueUtil.java @@ -2,7 +2,7 @@ * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. - * You may obtain an copy of the License at + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *