diff --git a/Readme.md b/Readme.md index 9f643c390d02310599b7b57f238f4cbdb463ec09..bced58b2d9cfde969856713e438a0c3b956a9006 100644 --- a/Readme.md +++ b/Readme.md @@ -7,7 +7,7 @@ - 功能: 通过代码即可实现阴影效果 - 项目移植状态: 主功能完成 - 调用差异: 无 -- 开发版本: sdk5,DevEco Studio 2.1 Release +- 开发版本: sdk6,DevEco Studio 2.2 Beta1 - 基线版本:Releases 0.1 @@ -34,7 +34,7 @@ allprojects { ...... } ``` -在sdk5,DevEco Studio 2.1 Release下项目可直接运行 +在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 @@ -49,7 +49,7 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +病毒安全检测通过 当前版本demo功能与原组件基本无差异 diff --git a/build.gradle b/build.gradle index 2eba0e4f66f64191f92300d0b96de1949dcabdf6..556044208315262092fe3c3e74f7192ac2e20aeb 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 } @@ -22,8 +22,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' } } diff --git a/entry/build.gradle b/entry/build.gradle index 74de5b7de48c6a072e0d6029dfbc2a46bbc9a88f..303c522ac59274139b9cf8fc67a169c7daf9583f 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 8741fecd3c1f17b5e3f5e286a5bc090a0e4f99c2..ec53c304cacd2e426374277230a72d7ae92286db 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -5,10 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5 } }, "deviceConfig": {}, diff --git a/entry/src/main/java/com/sxu/shadowdrawabledemo/MyApplication.java b/entry/src/main/java/com/sxu/shadowdrawabledemo/MyApplication.java index 0445ce1f042188ce4a8955f36b9bee16a5c1730a..f75ba1c9cc65cd04a9ef94ff764a3b36d45d0469 100644 --- a/entry/src/main/java/com/sxu/shadowdrawabledemo/MyApplication.java +++ b/entry/src/main/java/com/sxu/shadowdrawabledemo/MyApplication.java @@ -9,12 +9,19 @@ import ohos.app.Context; * @since 2021-04-07 */ public class MyApplication extends AbilityPackage { + + public static void setApplication(MyApplication application) { + MyApplication.context = application; + } + private static Context context; + @Override public void onInitialize() { super.onInitialize(); - context = this; + setApplication(this); } + public static Context getInstance() { return context; } diff --git a/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/MainAbilitySlice.java b/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/MainAbilitySlice.java index d53af81b5b94252557142f29cd7b95502f1ff997..10e1d0e6d3e6360d911a1a1c3d8dd51038c90e93 100644 --- a/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/MainAbilitySlice.java +++ b/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/MainAbilitySlice.java @@ -29,7 +29,7 @@ public class MainAbilitySlice extends AbilitySlice implements Component.ClickedL private static final int TEXT3SHADOWRADIUS = 10; private static final int OFFSETX = 3; private static final int OFFSETY = 3; - private static int CONTAINERTYPE = -1; + private int CONTAINERTYPE = -1; private static final int SCROLLBARTHICKNESS = 12; private static final int DIRECEION = 1; private static final float DENSITYFLOAT = 0.5f; @@ -57,7 +57,7 @@ public class MainAbilitySlice extends AbilitySlice implements Component.ClickedL pagerExampleText.setClickedListener(this::onClick); ShadowDrawable.setShadowDrawable(textView1,Color.getIntColor("#2979FF"),dpToPx(SHAPERADIUS), - Color.getIntColor("#992979FF"),dpToPx(SHADOWRADIUS),0,0); + Color.getIntColor("#992979FF"),dpToPx(SHADOWRADIUS),0,0); ShadowDrawable.setShadowDrawable(textView2, new int[] { Color.getIntColor("#536DFE"), Color.getIntColor("#7C4DFF")}, dpToPx(SHAPERADIUS), diff --git a/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/PagerExampleSlice.java b/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/PagerExampleSlice.java index 5822ff7968117ca8550e7bc4fd9a5edd21a88f9a..fe18bc85fdb6b29a191ee00ed58740b820ab2e7e 100644 --- a/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/PagerExampleSlice.java +++ b/entry/src/main/java/com/sxu/shadowdrawabledemo/slice/PagerExampleSlice.java @@ -22,10 +22,10 @@ public class PagerExampleSlice extends Fraction { private PageSlider pageSlider; private List dataList = new ArrayList<>(); private int PADDING; - private final int PADDING_SIZE = 12; - private final int PROPORTION = 3; - private final int DATALIST_SIZE = 5; - private final int SHAPERADIUS = 8; + private static final int PADDING_SIZE = 12; + private static final int PROPORTION = 3; + private static final int DATALIST_SIZE = 5; + private static final int SHAPERADIUS = 8; @Override protected Component onComponentAttached(LayoutScatter scatter, ComponentContainer container, Intent intent) { diff --git a/entry/src/ohosTest/config.json b/entry/src/ohosTest/config.json index c49ea5681895eeb4c59a47d3eb07d85571a7144c..dc720a018222a9070644fd421a7bd98f2c7ccd69 100644 --- a/entry/src/ohosTest/config.json +++ b/entry/src/ohosTest/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, diff --git a/shadowdrawable/build.gradle b/shadowdrawable/build.gradle index adada0e704e62d0eb9bd4509326943358951f230..d78b0a88ef2a765d4aec9a5facf5ef2f6d5ba449 100644 --- a/shadowdrawable/build.gradle +++ b/shadowdrawable/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.huawei.ohos.library' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/shadowdrawable/src/main/config.json b/shadowdrawable/src/main/config.json index 42f66da3f3816c839256964558e24dbbeb1d990c..4dd3c3186370d87707c3af5621b04e8f078ad3a2 100644 --- a/shadowdrawable/src/main/config.json +++ b/shadowdrawable/src/main/config.json @@ -3,13 +3,8 @@ "bundleName": "com.sxu.shadowdrawabledemo", "vendor": "sxu", "version": { - "code": 1, + "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" } }, "deviceConfig": {}, diff --git a/shadowdrawable/src/main/java/com/sxu/shadowdrawable/ShadowDrawable.java b/shadowdrawable/src/main/java/com/sxu/shadowdrawable/ShadowDrawable.java index 20b6ae177cf5b8b27cfc20b335a45504a5b1c8cc..748e6d49117eadb2a87ae563c7ba09135f87334b 100644 --- a/shadowdrawable/src/main/java/com/sxu/shadowdrawable/ShadowDrawable.java +++ b/shadowdrawable/src/main/java/com/sxu/shadowdrawable/ShadowDrawable.java @@ -16,7 +16,7 @@ import ohos.agp.utils.RectFloat; public class ShadowDrawable extends ShapeElement { /** * 定义一个内部形状圆的变量 - **/ + **/ public static final int SHAPE_ROUND = 1; /** * 定义一个外部形状圆的变量 @@ -369,7 +369,7 @@ public class ShadowDrawable extends ShapeElement { * @return Builder (设置背景颜色) */ public Builder setBgColor(int[] bgColor) { - this.mBgColor = bgColor; + this.mBgColor = bgColor.clone(); return this; }