diff --git a/build.gradle b/build.gradle index 03676856250801186e64eb703c0326e29a2246d5..33bfb5a630d1c6366ff457a34c6d8c273f0ae691 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.huawei.ohos.app' ohos { - compileSdkVersion 5 + compileSdkVersion 7 defaultConfig { compatibleSdkVersion 5 } @@ -19,8 +19,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.2.7' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:hap:3.0.3.4' + classpath 'com.huawei.ohos:decctest:1.2.6.0' } } diff --git a/entry/build.gradle b/entry/build.gradle index 8624e00f130397beb4d66cff2cf172980b77002b..540423c94c9879ef335291247b245b0cd615b015 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 7 defaultConfig { compatibleSdkVersion 5 } @@ -10,8 +10,8 @@ ohos { 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.8' + implementation 'io.openharmony.tpc.thirdlib:glide:1.1.2' + implementation 'io.openharmony.tpc.thirdlib:XPopup:1.1.1' implementation project(':timetableView') } decc { diff --git a/entry/src/main/config.json b/entry/src/main/config.json index c9f2ca02bfab6928266032976d0d91836f83c58f..96f457d19002e4922a3d9470dcdff6b64ac836d7 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -5,10 +5,6 @@ "version": { "code": 1, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5 } }, "deviceConfig": {}, @@ -44,9 +40,8 @@ } ], "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.MainAbility", - "label": "课表Demo", + "label": "$string:app_name", "type": "page", "launchType": "standard" }, @@ -61,7 +56,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.SimpleAbility", "type": "page", "launchType": "standard" @@ -77,7 +71,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.BaseFuncAbility", "type": "page", "launchType": "standard" @@ -93,7 +86,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.AttrAbility", "type": "page", "launchType": "standard" @@ -109,7 +101,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.ColorPoolAbility", "type": "page", "launchType": "standard" @@ -125,7 +116,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.ItemStyleAbility", "type": "page", "launchType": "standard" @@ -141,7 +131,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.CustomWidthAbility", "type": "page", "launchType": "standard" @@ -157,7 +146,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.ElasticAbility", "type": "page", "launchType": "standard" @@ -173,7 +161,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.SlideAbility", "type": "page", "launchType": "standard" @@ -189,7 +176,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.DateAbility", "type": "page", "launchType": "standard" @@ -205,7 +191,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.NonViewAbility", "type": "page", "launchType": "standard" @@ -221,7 +206,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.ExtrasAbility", "type": "page", "launchType": "standard" @@ -237,7 +221,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.FlaglayoutAbility", "type": "page", "launchType": "standard" @@ -253,7 +236,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.DateDelayAbility", "type": "page", "launchType": "standard" @@ -269,7 +251,6 @@ ] }, "orientation": "unspecified", - "formEnabled": false, "name": "com.zhuangfei.hos_timetableview.ability.LocalConfigAbility", "type": "page", "launchType": "standard" diff --git a/entry/src/main/java/com/zhuangfei/hos_timetableview/view/ElasticScrollView.java b/entry/src/main/java/com/zhuangfei/hos_timetableview/view/ElasticScrollView.java index 06c413e786198ba678d540987d9f13b607d677f5..3b564ac34a4396e9f808e857ef9bd65c6f9e25be 100644 --- a/entry/src/main/java/com/zhuangfei/hos_timetableview/view/ElasticScrollView.java +++ b/entry/src/main/java/com/zhuangfei/hos_timetableview/view/ElasticScrollView.java @@ -23,11 +23,12 @@ import ohos.agp.components.DirectionalLayout; import ohos.agp.utils.Rect; import ohos.app.Context; import ohos.multimodalinput.event.TouchEvent; +import ohos.system.version.SystemVersion; /** * 弹性滚动布局,下拉时会反弹 */ -public class ElasticScrollView extends DirectionalLayout implements Component.TouchEventListener { +public class ElasticScrollView extends DirectionalLayout { private Component inner; private float downY; private float deltaY; @@ -44,11 +45,25 @@ public class ElasticScrollView extends DirectionalLayout implements Component.To public ElasticScrollView(Context context, AttrSet attrSet, String styleName) { super(context, attrSet, styleName); - setTouchEventListener(this); + // sdk7以上事件和手势不分离,需要使用setForwardTouchListener来监听触摸手势 + if (SystemVersion.getApiVersion() >= 7) { + setForwardTouchListener(new ForwardTouchListener() { + @Override + public boolean onForwardTouch(Component component, TouchEvent touchEvent) { + return onTouch(component, touchEvent); + } + }); + } else { + setTouchEventListener(new TouchEventListener() { + @Override + public boolean onTouchEvent(Component component, TouchEvent touchEvent) { + return onTouch(component, touchEvent); + } + }); + } } - @Override - public boolean onTouchEvent(Component component, TouchEvent event) { + public boolean onTouch(Component component, TouchEvent event) { if (getChildCount() > 0) { inner = getComponentAt(0); } diff --git a/timetableView/build.gradle b/timetableView/build.gradle index f3beffcf152ff85ac5a6bfc224430458dcdcc1ff..ec21b5f2e523d9a5a1921046c919ab865947515d 100644 --- a/timetableView/build.gradle +++ b/timetableView/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.huawei.ohos.library' ohos { - compileSdkVersion 5 + compileSdkVersion 7 defaultConfig { compatibleSdkVersion 5 }