From 3e2db75a5fed646767efabc7468e9c0e3b502f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=A7=8B?= <1273378004@qq.com> Date: Thu, 15 Jul 2021 09:52:39 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.AttrSet=E8=8E=B7=E5=8F=96=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=B1=9E=E6=80=A7=E5=89=8D=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD=202.=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=86=85=E5=8F=82=E6=95=B0=E8=B5=8B=E5=80=BC=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=E8=BF=9B=E8=A1=8C=E6=94=B9?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhuangfei/timetable/view/PerWeekView.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java b/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java index a2392c4..7b5e8a5 100644 --- a/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java +++ b/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java @@ -4,6 +4,7 @@ import com.zhuangfei.timetable.model.Schedule; import com.zhuangfei.timetable.model.ScheduleEnable; import com.zhuangfei.timetable.model.ScheduleSupport; import com.zhuangfei.timetable.utils.ScreenUtils; +import ohos.agp.components.Attr; import ohos.agp.components.AttrSet; import ohos.agp.components.Component; import ohos.agp.render.Canvas; @@ -13,6 +14,7 @@ import ohos.app.Context; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; /** * 周次选择栏的每项自定义View,表示某周的有课情况. @@ -78,7 +80,7 @@ public class PerWeekView extends Component implements Component.DrawTask { * @return PerWeekView控件自身 */ public PerWeekView setLightColor(int lightARGBColor) { - this.lightColor = lightColor; + this.lightColor = lightARGBColor; invalidate(); return this; } @@ -90,7 +92,7 @@ public class PerWeekView extends Component implements Component.DrawTask { * @return PerWeekView控件自身 */ public PerWeekView setGrayColor(int grayARGBColor) { - this.grayColor = grayColor; + this.grayColor = grayARGBColor; invalidate(); return this; } @@ -151,7 +153,7 @@ public class PerWeekView extends Component implements Component.DrawTask { * @return PerWeekView控件自身 */ public PerWeekView setRadiusInPx(int radiusPx) { - this.radius = radius; + this.radius = radiusPx; return this; } @@ -187,18 +189,13 @@ public class PerWeekView extends Component implements Component.DrawTask { } private void initAttr(AttrSet attrs) { - int defRadius = ScreenUtils.vp2px(getContext(), 2); grayColor = Color.rgb(207, 219, 219); - if (attrs.getAttr(GRAY_COLOR).isPresent()) { - grayColor = attrs.getAttr(GRAY_COLOR).get().getColorValue().getValue(); - } lightColor = 0xff3FCAB8; - if (attrs.getAttr(LIGHT_COLOR).isPresent()) { - grayColor = attrs.getAttr(LIGHT_COLOR).get().getColorValue().getValue(); - } - radius = defRadius; - if (attrs.getAttr(RADIUS).isPresent()) { - radius = attrs.getAttr(RADIUS).get().getDimensionValue(); + radius = ScreenUtils.vp2px(getContext(), 2); + if (attrs != null) { + attrs.getAttr(GRAY_COLOR).ifPresent(attr -> grayColor = attr.getColorValue().getValue()); + attrs.getAttr(LIGHT_COLOR).ifPresent(attr -> lightColor = attr.getColorValue().getValue()); + attrs.getAttr(RADIUS).ifPresent(attr -> radius = attr.getDimensionValue()); } } -- Gitee From c61fa0f3262ab66df89413bc4ececb68ff7ca5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=A7=8B?= <1273378004@qq.com> Date: Thu, 15 Jul 2021 09:59:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8import?= =?UTF-8?q?=EF=BC=8C=E4=BE=9D=E8=B5=96=E7=9A=84XPopup=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=94=B9=E4=B8=BA1.0.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build.gradle | 2 +- .../src/main/java/com/zhuangfei/timetable/view/PerWeekView.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/entry/build.gradle b/entry/build.gradle index c9e54bc..8624e00 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) implementation 'com.google.code.gson:gson:2.8.0' implementation 'io.openharmony.tpc.thirdlib:glide:1.0.4' - implementation 'io.openharmony.tpc.thirdlib:XPopup:1.0.3' + implementation 'io.openharmony.tpc.thirdlib:XPopup:1.0.8' implementation project(':timetableView') } decc { diff --git a/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java b/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java index 7b5e8a5..409332e 100644 --- a/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java +++ b/timetableView/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java @@ -4,7 +4,6 @@ import com.zhuangfei.timetable.model.Schedule; import com.zhuangfei.timetable.model.ScheduleEnable; import com.zhuangfei.timetable.model.ScheduleSupport; import com.zhuangfei.timetable.utils.ScreenUtils; -import ohos.agp.components.Attr; import ohos.agp.components.AttrSet; import ohos.agp.components.Component; import ohos.agp.render.Canvas; @@ -14,7 +13,6 @@ import ohos.app.Context; import java.util.ArrayList; import java.util.List; -import java.util.function.Consumer; /** * 周次选择栏的每项自定义View,表示某周的有课情况. -- Gitee From cfb93b1905915cdcbb81c689974499b870f0496d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=A7=8B?= <1273378004@qq.com> Date: Thu, 15 Jul 2021 10:09:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?docs=EF=BC=9Amaven=E5=92=8Chapm=E5=8F=91?= =?UTF-8?q?=E5=B8=831.0.4=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- build.gradle | 2 +- changelog.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 560d764..947e2e9 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ allprojects{ mavenCentral() } } -implementation 'io.openharmony.tpc.thirdlib:TimetableView:1.0.3' +implementation 'io.openharmony.tpc.thirdlib:TimetableView:1.0.4' ``` ## xml属性 diff --git a/build.gradle b/build.gradle index ef3f577..0367685 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.2.5' + classpath 'com.huawei.ohos:hap:2.4.2.7' classpath 'com.huawei.ohos:decctest:1.0.0.6' } } diff --git a/changelog.md b/changelog.md index 1145c52..85cdff6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## 1.0.4 +修复PerWeekView控件几个接口失效的问题 + ## 1.0.3 修改readme图片路径为绝对路径 -- Gitee