(mLayoutInflater, layoutRes, parent, false))
-
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/vienan/app/expandableswipelistview/model/Dummy.java b/app/src/main/java/vienan/app/expandableswipelistview/model/Dummy.java
deleted file mode 100644
index 7df3526085533f26753fb7b44a4949add7896f37..0000000000000000000000000000000000000000
--- a/app/src/main/java/vienan/app/expandableswipelistview/model/Dummy.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package vienan.app.expandableswipelistview.model;
-
-public class Dummy {
-}
diff --git a/app/src/main/java/vienan/app/expandableswipelistview/model/LineItem.java b/app/src/main/java/vienan/app/expandableswipelistview/model/LineItem.java
deleted file mode 100644
index 18e6257e11f5cad201048098736126e527d4b0cf..0000000000000000000000000000000000000000
--- a/app/src/main/java/vienan/app/expandableswipelistview/model/LineItem.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package vienan.app.expandableswipelistview.model;
-
-/**
- * 页面描述:
- *
- * Created by ditclear on 2016/12/17.
- */
-
-public class LineItem {
-
- private String content;
- private boolean isLeft;
-
- private boolean isOpened=false;
-
- public boolean isOpened() {
- return isOpened;
- }
-
- public void setOpened(boolean opened) {
- isOpened = opened;
- }
-
- public LineItem(String content, boolean isLeft) {
- this.content = content;
- this.isLeft = isLeft;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public boolean isLeft() {
- return isLeft;
- }
-
- public void setLeft(boolean left) {
- isLeft = left;
- }
-}
diff --git a/app/src/main/res/drawable/bg_item.xml b/app/src/main/res/drawable/bg_item.xml
deleted file mode 100644
index 7e6665996583c7924c31968a5bfcaafac7490da0..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/bg_item.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_item_trash.xml b/app/src/main/res/drawable/bg_item_trash.xml
deleted file mode 100644
index 2bc5c72c7cd9743ad58f900af841d26a50ce9fcd..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/bg_item_trash.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/type_edit.xml b/app/src/main/res/drawable/type_edit.xml
deleted file mode 100644
index 7e576888e2b790ce8af21f561521db224a5f0bc6..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/type_edit.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index fa9a219dfa54a751fc4cb1789d3df7d2423a2c7c..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/child_status_item.xml b/app/src/main/res/layout/child_status_item.xml
deleted file mode 100644
index 71d49047957a4779ece73d6d59805ca15e9d8772..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/child_status_item.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/group_status_item.xml b/app/src/main/res/layout/group_status_item.xml
deleted file mode 100644
index aec3e2d109a3b78e834daf32a5781f4c1983cf90..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/group_status_item.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_recylerview_single_type.xml b/app/src/main/res/layout/item_recylerview_single_type.xml
deleted file mode 100644
index 132b3d7b89142e97ec7312592162ff4295fa79ed..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/item_recylerview_single_type.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_test.xml b/app/src/main/res/layout/layout_test.xml
deleted file mode 100644
index 714c3ed032a13755d00fec4c318aa0f5751e9df3..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/layout_test.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_activity.xml b/app/src/main/res/layout/list_activity.xml
deleted file mode 100644
index 96376a4bbbd4711f5fb3d5ec4861853653b4a5be..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/list_activity.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/recycler_activity.xml b/app/src/main/res/layout/recycler_activity.xml
deleted file mode 100644
index 3def572e0a045fcc5735704a0edea6f9573e15f1..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/recycler_activity.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
deleted file mode 100644
index 1eee2f67df448e4c7b26ff52374f560fea8b1135..0000000000000000000000000000000000000000
--- a/app/src/main/res/menu/menu_main.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/app/src/main/res/mipmap-hdpi/edit.png b/app/src/main/res/mipmap-hdpi/edit.png
deleted file mode 100644
index 595ff10ac241c28cd774720f34a91f58c6892dcf..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-hdpi/edit.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bcccec65160d92116f20ffce4fce0b5245c..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_star_border_white_48dp.png b/app/src/main/res/mipmap-hdpi/ic_star_border_white_48dp.png
deleted file mode 100644
index 7e41906c5f2274e7eb593dfd20f672eaf7d7326f..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_star_border_white_48dp.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/icons_ok.png b/app/src/main/res/mipmap-hdpi/icons_ok.png
deleted file mode 100644
index 19151c79a391a847ed24d419f0ea3c4cfd7a64af..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-hdpi/icons_ok.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c133a0cbd379f5af6dbf1a899a0293ca5eccfad0..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index bfa42f0e7b91d006d22352c9ff2f134e504e3c1d..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 324e72cdd7480cb983fa1bcc7ce686e51ef87fe7..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
deleted file mode 100644
index 63fc816444614bd64f68a372d1f93211628ee51d..0000000000000000000000000000000000000000
--- a/app/src/main/res/values-w820dp/dimens.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 64dp
-
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
deleted file mode 100644
index a593c0b7359557ef5f8ec341937c823378352d70..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- #3F51B5
- #303F9F
- #FF4081
- #FA364E
-
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 47c82246738c4d056e8030d3a259206f42e8e15d..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 16dp
- 16dp
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index eea7dbb085a945cd1f5653242868aed6bc5cdd1a..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- TimeLine
-
- Hello world!
- Settings
-
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index a99e1e6b7299a1a7811d49fea3bbe1bb9c1463c7..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
diff --git a/app/src/main/resources/base/element/string.json b/app/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..65626ba6463bd3effd632f37e8faf3c7b540c591
--- /dev/null
+++ b/app/src/main/resources/base/element/string.json
@@ -0,0 +1,40 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "TimeLine"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "demolistability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "demolistability_HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "app_DemoListAbility",
+ "value": "app_DemoListAbility"
+ },
+ {
+ "name": "recycleability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "recycleability_HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "app_RecycleAbility",
+ "value": "app_RecycleAbility"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/background_ability_demo_list.xml b/app/src/main/resources/base/graphic/background_ability_demo_list.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a002c2353e78af3a15235e00738328ff566bc085
--- /dev/null
+++ b/app/src/main/resources/base/graphic/background_ability_demo_list.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/background_ability_main.xml b/app/src/main/resources/base/graphic/background_ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c0c0a3df480fa387a452b9c40ca191cc918a3fc0
--- /dev/null
+++ b/app/src/main/resources/base/graphic/background_ability_main.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/background_ability_recycle.xml b/app/src/main/resources/base/graphic/background_ability_recycle.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a002c2353e78af3a15235e00738328ff566bc085
--- /dev/null
+++ b/app/src/main/resources/base/graphic/background_ability_recycle.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/background_tool.xml b/app/src/main/resources/base/graphic/background_tool.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d67d093e54ce5989e63cc79929e2e7aaced4849b
--- /dev/null
+++ b/app/src/main/resources/base/graphic/background_tool.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/edit_back.xml b/app/src/main/resources/base/graphic/edit_back.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d608675b48f07ea5384cbfd56afaf22b0321a2db
--- /dev/null
+++ b/app/src/main/resources/base/graphic/edit_back.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/mag_edit_back.xml b/app/src/main/resources/base/graphic/mag_edit_back.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d1f415f4c1f05e01b019bfb92c4a09c7f8b079d1
--- /dev/null
+++ b/app/src/main/resources/base/graphic/mag_edit_back.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/switch_false_true.xml b/app/src/main/resources/base/graphic/switch_false_true.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f59666dd1e5bc7d98303253bfa4376b4f2f58ec7
--- /dev/null
+++ b/app/src/main/resources/base/graphic/switch_false_true.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/app/src/main/resources/base/layout/ability_demo_list.xml b/app/src/main/resources/base/layout/ability_demo_list.xml
new file mode 100644
index 0000000000000000000000000000000000000000..42ff649c5d32b7568239f988a81da438dc07f5ff
--- /dev/null
+++ b/app/src/main/resources/base/layout/ability_demo_list.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/layout/ability_main.xml b/app/src/main/resources/base/layout/ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7e77280ed56c788c2447cdaf4f11962c86fcf8e4
--- /dev/null
+++ b/app/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/layout/layout_popudialog.xml b/app/src/main/resources/base/layout/layout_popudialog.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f2e0cbfbd3987a4476ea7288bb87d3a1f4bb13fd
--- /dev/null
+++ b/app/src/main/resources/base/layout/layout_popudialog.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/layout/layout_toast.xml b/app/src/main/resources/base/layout/layout_toast.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2b0f2ee39817e754cc2b379bec7400a8b20b412f
--- /dev/null
+++ b/app/src/main/resources/base/layout/layout_toast.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/layout/list_item.xml b/app/src/main/resources/base/layout/list_item.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dda76ab8564e03e65c0d043b77a037f3c9e833d2
--- /dev/null
+++ b/app/src/main/resources/base/layout/list_item.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/media/cuohao.png b/app/src/main/resources/base/media/cuohao.png
new file mode 100644
index 0000000000000000000000000000000000000000..9729573d53d330feb493cdbee4a2db3f4c060a02
Binary files /dev/null and b/app/src/main/resources/base/media/cuohao.png differ
diff --git a/app/src/main/resources/base/media/edit.png b/app/src/main/resources/base/media/edit.png
new file mode 100644
index 0000000000000000000000000000000000000000..285a1f97513b9c40a504386a562483ec2eebf26d
Binary files /dev/null and b/app/src/main/resources/base/media/edit.png differ
diff --git a/app/src/main/resources/base/media/icon.png b/app/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/app/src/main/resources/base/media/icon.png differ
diff --git a/app/src/main/res/mipmap-hdpi/star.png b/app/src/main/resources/base/media/star.png
similarity index 100%
rename from app/src/main/res/mipmap-hdpi/star.png
rename to app/src/main/resources/base/media/star.png
diff --git a/app/src/main/resources/base/media/switch_false.png b/app/src/main/resources/base/media/switch_false.png
new file mode 100644
index 0000000000000000000000000000000000000000..73e4d1edb8d78fb781cf49d283ea85602570c1b7
Binary files /dev/null and b/app/src/main/resources/base/media/switch_false.png differ
diff --git a/app/src/main/resources/base/media/switch_true.png b/app/src/main/resources/base/media/switch_true.png
new file mode 100644
index 0000000000000000000000000000000000000000..5cab8b362e790c8faa50a5bf593c81cba4873e28
Binary files /dev/null and b/app/src/main/resources/base/media/switch_true.png differ
diff --git a/app/src/main/res/mipmap-hdpi/trash.png b/app/src/main/resources/base/media/trash.png
similarity index 100%
rename from app/src/main/res/mipmap-hdpi/trash.png
rename to app/src/main/resources/base/media/trash.png
diff --git a/app/src/main/resources/en/element/string.json b/app/src/main/resources/en/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6fc4482112e92fec630bee3dff5f1240c880290e
--- /dev/null
+++ b/app/src/main/resources/en/element/string.json
@@ -0,0 +1,52 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "TimeLine"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "app_DemoListAbility",
+ "value": "app_DemoListAbility"
+ },
+ {
+ "name": "demolistability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "demolistability_HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "app_RecyAbility",
+ "value": "app_RecyAbility"
+ },
+ {
+ "name": "recyability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "recyability_HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "app_RecycleAbility",
+ "value": "app_RecycleAbility"
+ },
+ {
+ "name": "recycleability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "recycleability_HelloWorld",
+ "value": "Hello World"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/resources/zh/element/string.json b/app/src/main/resources/zh/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..3d9ee871579abf83a36cec71e610c5a41027628b
--- /dev/null
+++ b/app/src/main/resources/zh/element/string.json
@@ -0,0 +1,52 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "TimeLine"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "mainability_HelloWorld",
+ "value": "你好,世界"
+ },
+ {
+ "name": "app_DemoListAbility",
+ "value": "app_DemoListAbility"
+ },
+ {
+ "name": "demolistability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "demolistability_HelloWorld",
+ "value": "你好,世界"
+ },
+ {
+ "name": "app_RecyAbility",
+ "value": "app_RecyAbility"
+ },
+ {
+ "name": "recyability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "recyability_HelloWorld",
+ "value": "你好,世界"
+ },
+ {
+ "name": "app_RecycleAbility",
+ "value": "app_RecycleAbility"
+ },
+ {
+ "name": "recycleability_description",
+ "value": "Java_Empty Ability"
+ },
+ {
+ "name": "recycleability_HelloWorld",
+ "value": "你好,世界"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/ohosTest/java/com/anlia/timeline/ExampleOhosTest.java b/app/src/ohosTest/java/com/anlia/timeline/ExampleOhosTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..703dd021df1e65471aafa64fcc6dcfe1a864a9c1
--- /dev/null
+++ b/app/src/ohosTest/java/com/anlia/timeline/ExampleOhosTest.java
@@ -0,0 +1,15 @@
+package vienan.app.expandableswipelistview;
+
+import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ExampleOhosTest {
+ // ui组件,不涉及单元测试
+ @Test
+ public void testBundleName() {
+ final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
+ assertEquals("vienan.app.expandableswipelistview", actualBundleName);
+ }
+}
\ No newline at end of file
diff --git a/app/src/test/java/com/anlia/timeline/ExampleTest.java b/app/src/test/java/com/anlia/timeline/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..523ccd91d05a3efaf3f55f70312ec8e5aa270bbc
--- /dev/null
+++ b/app/src/test/java/com/anlia/timeline/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.anlia.timeline;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/build.gradle b/build.gradle
index a1c82d82f4652604cd374221beb98b43c3d11bb4..3a41c328e590c35c56441837592a1f186768a759 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,28 +1,34 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+}
+
buildscript {
- ext.kotlin_version = '1.2.41'
repositories {
maven {
- url 'https://maven.google.com'
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
}
- jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.2'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.novoda:bintray-release:0.8.0'
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.huawei.ohos:hap:2.4.5.0'
+ classpath 'com.huawei.ohos:decctest:1.2.4.1'
}
}
allprojects {
repositories {
maven {
- url 'https://maven.google.com'
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
}
- maven { url "https://jitpack.io" }
- jcenter()
}
}
diff --git a/gradle.properties b/gradle.properties
index 95a2c2b15159aca9e0fd3d1010ea102fc030a244..be492496f9a20ac2d980ef4fc30061f4184c1c40 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,18 +1,13 @@
# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
+# IDE (e.g. DevEco Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
-
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
-
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
- org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
- org.gradle.parallel=true
\ No newline at end of file
+# If the Chinese output is garbled, please configure the following parameter.
+# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false.
+# more information see https://docs.gradle.org/current/userguide/performance.html
+# org.gradle.parallel=false
+# org.gradle.jvmargs=-Dfile.encoding=GBK
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 8c0fb64a8698b08ecc4158d828ca593c4928e9dd..490fda8577df6c95960ba7077c43220e5bb2c0d9 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index add24c77cab64a9cb8f510471e3bfe7140418529..f59159e865d4b59feb1b8c44b001f62fc5d58df4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Nov 02 20:48:26 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
diff --git a/gradlew b/gradlew
index 91a7e269e19dfc62e27137a0b57ef3e430cee4fd..910a9a4e3a3d633c759060a269f51f260796cce9 100755
--- a/gradlew
+++ b/gradlew
@@ -1,164 +1,183 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
+#!/usr/bin/env sh
+
+ #
+ # Copyright 2015 the original author or authors.
+ #
+ # 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 a copy of the License at
+ #
+ # https://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
+ ##############################################################################
+ ##
+ ## Gradle start up script for UN*X
+ ##
+ ##############################################################################
+
+ # Attempt to set APP_HOME
+ # Resolve links: $0 may be a link
+ PRG="$0"
+ # Need this for relative symlinks.
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+ done
+ SAVED="`pwd`"
+ cd "`dirname \"$PRG\"`/" >/dev/null
+ APP_HOME="`pwd -P`"
+ cd "$SAVED" >/dev/null
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+ APP_NAME="Gradle"
+ APP_BASE_NAME=`basename "$0"`
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
+ MAX_FD="maximum"
-warn ( ) {
+ warn () {
echo "$*"
-}
+ }
-die ( ) {
+ die () {
echo
echo "$*"
echo
exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
+ }
+
+ # OS specific support (must be 'true' or 'false').
+ cygwin=false
+ msys=false
+ darwin=false
+ nonstop=false
+ case "`uname`" in
+ CYGWIN* )
cygwin=true
;;
- Darwin* )
+ Darwin* )
darwin=true
;;
- MINGW* )
+ MINGW* )
msys=true
;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
+ NONSTOP* )
+ nonstop=true
+ ;;
+ esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
+ # Determine the Java command to use to start the JVM.
+ if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
+ Please set the JAVA_HOME variable in your environment to match the
+ location of your Java installation."
fi
-else
+ else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
+ Please set the JAVA_HOME variable in your environment to match the
+ location of your Java installation."
+ fi
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ # Increase the maximum file descriptors if we can.
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
fi
-fi
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
+ # For Darwin, add options to specify how the application appears in the dock
+ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
+ fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+ # For Cygwin or MSYS, switch paths to Windows format before running java
+ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
-fi
+ fi
+
+ # Escape application args
+ save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+ }
+ APP_ARGS=`save "$@"`
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+ exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 8a0b282aa6885fb573c106b3551f7275c5f17e8e..62bd9b9ccefea2b65ae41e5d9a545e2021b90a1d 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,17 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +65,9 @@ echo location of your Java installation.
goto fail
:init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +78,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
diff --git a/imag/timeline.gif b/imag/timeline.gif
new file mode 100644
index 0000000000000000000000000000000000000000..83783fc1924fd71a8932eaaf27bd6185abbf6147
Binary files /dev/null and b/imag/timeline.gif differ
diff --git a/screenshot/feature.gif b/screenshot/feature.gif
deleted file mode 100644
index 282e0fdb28be4e34f762a9dc48278af8db1160dd..0000000000000000000000000000000000000000
Binary files a/screenshot/feature.gif and /dev/null differ
diff --git a/screenshot/listview.gif b/screenshot/listview.gif
deleted file mode 100644
index 0b8eed9a9e536c3103483b0c8a784eee222ee10a..0000000000000000000000000000000000000000
Binary files a/screenshot/listview.gif and /dev/null differ
diff --git a/screenshot/modify.gif b/screenshot/modify.gif
deleted file mode 100644
index 4b29f0721f6fe434a65e2ff3b519d39c85258285..0000000000000000000000000000000000000000
Binary files a/screenshot/modify.gif and /dev/null differ
diff --git a/screenshot/recyclerview.gif b/screenshot/recyclerview.gif
deleted file mode 100644
index 810bdc1b3975df47748cc1fd00fde4236f06e558..0000000000000000000000000000000000000000
Binary files a/screenshot/recyclerview.gif and /dev/null differ
diff --git a/swipelayout/.classpath b/swipelayout/.classpath
deleted file mode 100644
index eb19361b5711e614b090eac2f1b51309da2ec1e4..0000000000000000000000000000000000000000
--- a/swipelayout/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/swipelayout/.project b/swipelayout/.project
deleted file mode 100644
index af197c686fe7633700d5473abb2bb98882288899..0000000000000000000000000000000000000000
--- a/swipelayout/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- swipelayout
- Project swipelayout created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/swipelayout/.settings/org.eclipse.buildship.core.prefs b/swipelayout/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index b1886adb46c085de842f1283c1a3c25151bfc988..0000000000000000000000000000000000000000
--- a/swipelayout/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1
diff --git a/swipelayout/build.gradle b/swipelayout/build.gradle
index b8aea7772b769432cbad75a48cf8a22f7157e7c5..7e1e475c1296e7c6d200a45810598ddff583ee7f 100644
--- a/swipelayout/build.gradle
+++ b/swipelayout/build.gradle
@@ -1,37 +1,21 @@
-apply plugin: 'com.android.library'
-apply plugin: 'com.novoda.bintray-release'
-
-android {
- compileSdkVersion 27
- buildToolsVersion "27.0.3"
-
+apply plugin: 'com.huawei.ohos.library'
+ohos {
+ compileSdkVersion 6
defaultConfig {
- minSdkVersion 17
- targetSdkVersion 26
- versionCode 1
- versionName "1.0"
+ compatibleSdkVersion 5
}
buildTypes {
release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
}
}
- lintOptions {
- abortOnError false
- }
-
+
}
dependencies {
- compile 'com.android.support:support-v4:27.1.1'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ testImplementation 'junit:junit:4.13'
}
-
-publish {
- userOrg = 'vienan'
- groupId = 'com.ditclear'
- artifactId = 'swipedraglayout'
- publishVersion = '1.1.0'
- desc = 'a swipeable layout with overScroll effect'
- website = 'https://github.com/ditclear/TimeLine'
-}
\ No newline at end of file
diff --git a/swipelayout/consumer-rules.pro b/swipelayout/consumer-rules.pro
new file mode 100644
index 0000000000000000000000000000000000000000..9dccc613bc71b04b83531f550bdab2fb667ecfc9
--- /dev/null
+++ b/swipelayout/consumer-rules.pro
@@ -0,0 +1 @@
+# Add har specific ProGuard rules for consumer here.
\ No newline at end of file
diff --git a/swipelayout/proguard-rules.pro b/swipelayout/proguard-rules.pro
index 86e415c5113da33f9bf1bcfd9c751a30a06784d4..f7666e47561d514b2a76d5a7dfbb43ede86da92a 100644
--- a/swipelayout/proguard-rules.pro
+++ b/swipelayout/proguard-rules.pro
@@ -1,17 +1 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/vienan/Library/Android/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
+# config module specific ProGuard rules here.
\ No newline at end of file
diff --git a/swipelayout/src/main/AndroidManifest.xml b/swipelayout/src/main/AndroidManifest.xml
deleted file mode 100644
index 74784f8df6ef87aa61f546faab769e7f21973ba7..0000000000000000000000000000000000000000
--- a/swipelayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
diff --git a/swipelayout/src/main/config.json b/swipelayout/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..0a59f71ed2d691e9d954a718773e43f06b22e6d6
--- /dev/null
+++ b/swipelayout/src/main/config.json
@@ -0,0 +1,23 @@
+{
+ "app": {
+ "bundleName": "com.anlia.swipelayout",
+ "vendor": "anlia",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {
+ },
+ "module": {
+ "package": "com.anlia.swipelayout",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "swipelayout",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/swipelayout/src/main/java/com/ditclear/swipelayout/SwipeDragLayout.java b/swipelayout/src/main/java/com/ditclear/swipelayout/SwipeDragLayout.java
index 38abdab055d819739e23abab8291abddf340b193..8c83335073d42acf75dc661acb077de44d733d94 100644
--- a/swipelayout/src/main/java/com/ditclear/swipelayout/SwipeDragLayout.java
+++ b/swipelayout/src/main/java/com/ditclear/swipelayout/SwipeDragLayout.java
@@ -1,405 +1,519 @@
package com.ditclear.swipelayout;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Point;
-import android.support.v4.widget.ViewDragHelper;
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
+import ohos.agp.animation.Animator;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.components.*;
+import ohos.agp.window.service.DisplayManager;
+import ohos.app.Context;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+import ohos.multimodalinput.event.MmiPoint;
+import ohos.multimodalinput.event.TouchEvent;
/**
* Created by ditclear on 16/7/12. 可滑动的layout extends FrameLayout
*/
-public class SwipeDragLayout extends FrameLayout {
-
- private final String TAG=getClass().getSimpleName();
- private static SwipeDragLayout mCacheView;
- public final static int DIRECTION_LEFT = 1;
- public final static int DIRECTION_RIGHT = 2;
- private View contentView;
- private View menuView;
- private ViewDragHelper mDragHelper;
- private Point originPos = new Point();
- private boolean isOpen, ios, swipeEnable;
- private boolean clickToClose=true;
- private int swipeDirection = DIRECTION_LEFT;
- private float offsetRatio;
- private float needOffset = 0.2f;
- private SwipeListener mListener;
- //防止多指拖动,当第一个被拖动时,置为true,其它的则不触发拖动
- private static boolean isTouching;
-
+public class SwipeDragLayout extends StackLayout implements Component.TouchEventListener,
+ Component.BindStateChangedListener, Component.DraggedListener {
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "SwipeDragLayout");
+ private static final String LEFT = "left";
+ private static final int ZERO = 0;
+ private static final int TIME = 200;
+ private SwipeListContainerListener swipeListContainerListener;
+ private SwipeListener swipeListener;
+ private Component mComponentSlideOver;
+ private Component mComponentSlide;
+ private AnimatorProperty mSlideAnimator;
+ private AnimatorProperty mSlideOverAnimator;
+ private Context mContext;
+ private float slideX;
+ private float slideOver;
+ private float moveX;
+ private String mLeftRight; // 方向
+ private int mBackDistance; // 回弹距离
+ private double needOffset;
+ private boolean isSpringBack; // 回弹
+ private boolean isSliding; // 是否可滑动
+ private double mDownX;
+ private boolean isOpenCloseLeft;
+ private boolean isLtR;
+ private boolean isLeft;
+ private boolean isRight;
+ private double offsetRatio;
+
+ /**
+ * 构造
+ *
+ * @param context 上下文
+ */
public SwipeDragLayout(Context context) {
- this(context, null);
+ super(context);
}
- public SwipeDragLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
+ /**
+ * 构造
+ *
+ * @param context 上下文
+ * @param attrSet 属性集
+ */
+ public SwipeDragLayout(Context context, AttrSet attrSet) {
+ super(context, attrSet);
+ init(context, attrSet);
}
- public SwipeDragLayout(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
+ private void init(Context context, AttrSet attrSet) {
+ mContext = context;
+ setTouchEventListener(this);
+ setBindStateChangedListener(this);
+ isSpringBack = TypedAttrUtils.getBoolean(attrSet, "spring_back", false);
+ isSliding = TypedAttrUtils.getBoolean(attrSet, "swipe_enable", false);
+ mLeftRight = TypedAttrUtils.getString(attrSet, "swipe_direction", LEFT);
+ needOffset = TypedAttrUtils.getInt(attrSet,"need_offset",2);
+ setDraggedListener(DRAG_HORIZONTAL, this);
+ }
- TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.SwipeDragLayout);
- //最小滑动距离
- needOffset = array.getFloat(R.styleable.SwipeDragLayout_need_offset, 0.2f);
- //是否有回弹效果
- ios = array.getBoolean(R.styleable.SwipeDragLayout_ios, false);
- //是否可滑动
- swipeEnable = array.getBoolean(R.styleable.SwipeDragLayout_swipe_enable, true);
- //滑动方向,默认左滑
- swipeDirection = array.getInt(R.styleable.SwipeDragLayout_swipe_direction, DIRECTION_LEFT);
- init();
- array.recycle();
+ public void setSwipeListContainerListener(SwipeListContainerListener listContainerListener) {
+ this.swipeListContainerListener = listContainerListener;
}
- public static SwipeDragLayout getCacheView() {
- return mCacheView;
+ public void setSwipeListener(SwipeListener swipeListener) {
+ this.swipeListener = swipeListener;
}
- //初始化dragHelper,对拖动的view进行操作
- private void init() {
- mDragHelper = ViewDragHelper.create(this, 1f, new ViewDragHelper.Callback() {
- @Override
- public boolean tryCaptureView(View child, int pointerId) {
- //捕获contentView
- return child == contentView;
- }
- @Override
- public int clampViewPositionHorizontal(View child, int left, int dx) {
- //滑动距离,如果启动IOS效果,则可滑动4/3倍菜单宽度的距离
- if (swipeDirection == DIRECTION_LEFT) {
- //左滑
- final int leftBound = getPaddingLeft() - (ios ? menuView.getWidth() * 4 / 3
- : menuView.getWidth());
- final int rightBound = getWidth() - child.getWidth();
- return Math.min(Math.max(left, leftBound), rightBound);
+ @Override
+ public boolean onTouchEvent(Component component, TouchEvent touchEvent) {
+ component.setEnabled(isSliding);
+ MmiPoint pointerPosition = touchEvent.getPointerPosition(ZERO);
+ if (touchEvent.getAction() == TouchEvent.PRIMARY_POINT_DOWN) {
+ mDownX = pointerPosition.getX();
+ } else if (touchEvent.getAction() == TouchEvent.POINT_MOVE) {
+ moveX = pointerPosition.getX();
+ } else if (touchEvent.getAction() == TouchEvent.PRIMARY_POINT_UP) {
+ if (!(mDownX == moveX) && !(mDownX == pointerPosition.getX())
+ && mComponentSlideOver.getContentPositionX() != 0) {
+ mComponentSlideOver.setEnabled(true);
+ if (isLeftRight()) {
+ leftRightUp();
} else {
- final int leftBound = 0;
- final int rightBound = (ios ? menuView.getWidth() * 4 / 3 : menuView.getWidth());
- return Math.min(Math.max(left,leftBound),rightBound);
+ rightLeftUp();
}
+ } else {
+ selectedDown();
}
+ }
+ if (isSliding) {
+ return true;
+ } else {
+ return false;
+ }
+ }
- @Override
- public int getViewHorizontalDragRange(View child) {
- return contentView == child ? menuView.getWidth() : 0;
- }
+ private void selectedDown() {
+ int[] mOnScreen = mComponentSlide.getLocationOnScreen();
+ if (mComponentSlideOver.getContentPositionX() != 0 && leftRightX(mOnScreen[0])) {
+ mComponentSlideOver.setEnabled(false);
+ slideDown();
+ }
+ }
- @Override
- public int clampViewPositionVertical(View child, int top, int dy) {
- //fix issue 6 List滚动和Item左右滑动有冲突
- // {@link https://github.com/ditclear/SwipeLayout/issues/6}
- getParent().requestDisallowInterceptTouchEvent(true);
- return super.clampViewPositionVertical(child, top, dy);
- }
+ private boolean leftRightX(int downX) {
+ return isLeftRight() ? mDownX < downX : mDownX > mComponentSlide.getEstimatedWidth();
+ }
- @Override
- public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
- final int childWidth = menuView.getWidth();
- //offsetRatio can callback here
- if (swipeDirection == DIRECTION_LEFT) {
- offsetRatio = -(float) (left - getPaddingLeft()) / childWidth;
- menuView.setTranslationX(Math.max(-menuView.getWidth(), left));
- } else {
- offsetRatio = ((float) left) / childWidth;
- menuView.setTranslationX(Math.min(menuView.getWidth(), left));
- }
- if (mListener != null) {
- mListener.onUpdate(SwipeDragLayout.this, offsetRatio, left);
- }
+ private void slideDown() {
+ if (mComponentSlideOver.getContentPositionX() != 0) {
+ if (isLeftRight()) {
+ isLeft = false;
+ animationToX();
+ } else {
+ isRight = false;
+ animationRightFrom();
}
+ }
+ }
- @Override
- public void onViewReleased(View releasedChild, float xvel, float yvel) {
- super.onViewReleased(releasedChild, xvel, yvel);
- //松手时,判断打开还是关闭
- if (swipeDirection == DIRECTION_LEFT) {
- autoLeft();
- } else {
- autoRight();
- }
+ private void animationRightFrom() {
+ mSlideAnimator.moveFromX(mComponentSlide.getContentPositionX())
+ .moveToX(-mComponentSlide.getEstimatedWidth()).setDuration(TIME).start();
+ mSlideOverAnimator.moveFromX(mComponentSlideOver.getContentPositionX()).moveToX(ZERO).setDuration(TIME).start();
+ }
+
+ /**
+ * 右-->左(right)
+ *
+ * @param rightX x轴
+ */
+ private void openRight(double rightX) {
+ isOpen();
+ contSlide(rightX);
+ if (slideOver >= mComponentSlide.getEstimatedWidth()) {
+ springBack();
+ if (!isSpringBack) {
+ mComponentSlide.setContentPositionX(ZERO);
+ mComponentSlideOver.setContentPositionX(mComponentSlide.getEstimatedWidth());
}
- });
+ } else {
+ openCloseX();
+ }
+ }
+ private void closeLeft(double leftX) {
+ contSlide(leftX);
+ if (slideOver >= 0) {
+ mComponentSlide.setContentPositionX(getScreenWidth());
+ mComponentSlideOver.setContentPositionX(0);
+ } else {
+ closeSlide();
+ }
}
- private void autoRight() {
- if (isOpen) {
- if (offsetRatio != 1 && offsetRatio > (1 - needOffset)) {
- open();
- } else if (offsetRatio == 1) {
- if (clickToClose) {
- close();
- if (mListener != null) {
- mListener.onClosed(SwipeDragLayout.this);
- }
- }
- } else {
- close();
- if (mListener != null) {
- mListener.onClosed(SwipeDragLayout.this);
- }
- }
+ private void closeSlide() {
+ if (isSpringBack && Math.abs(slideOver) > mComponentSlide.getEstimatedWidth()) {
+ mComponentSlideOver.setContentPositionX(slideOver);
} else {
- if (offsetRatio != 0 && offsetRatio < needOffset) {
- close();
- } else if (offsetRatio == 0) {
- getParent().requestDisallowInterceptTouchEvent(false);
- } else {
- open();
- if (mListener != null) {
- mListener.onOpened(SwipeDragLayout.this);
- }
- }
+ openCloseX();
}
}
- public int getSwipeDirection() {
- return swipeDirection;
+ public void setNeedOffset(int offset) {
+ this.needOffset = offset;
+ }
+
+ private void closeRight(double rightX) {
+ contSlide(rightX);
+ if (slideOver >= 0) {
+ closeSlide();
+ }
}
- public void setSwipeDirection(int swipeDirection) {
- if (this.swipeDirection != swipeDirection) {
- this.swipeDirection = swipeDirection;
- requestLayout();
+ private void openCloseX() {
+ mComponentSlide.setContentPositionX(slideX);
+ mComponentSlideOver.setContentPositionX(slideOver);
+ }
+
+ private void openLeft(double leftX) {
+ isOpen();
+ contSlide(leftX);
+ if (Math.abs(slideOver) >= mComponentSlide.getEstimatedWidth()) {
+ springBack();
+ if (!isSpringBack) {
+ mComponentSlide.setContentPositionX(slidingDistance());
+ mComponentSlideOver.setContentPositionX(-mComponentSlide.getEstimatedWidth());
+ }
+ } else {
+ openCloseX();
}
}
- public void setSwipeEnable(boolean swipeEnable) {
- this.swipeEnable = swipeEnable;
- if (!swipeEnable&&mCacheView!=null){
- mCacheView.close();
- mCacheView = null;
+ private void isOpen() {
+ if (isOpenCloseLeft) {
+ if (swipeListContainerListener != null) {
+ isOpenCloseLeft = false;
+ swipeListContainerListener.openSwipe(this);
+ }
}
}
- public void setNeedOffset(float needOffset) {
- this.needOffset = needOffset;
+ private void contSlide(double leftX) {
+ slideOver = slideOver(leftX);
+ slideX = slideValue(leftX);
}
- private void autoLeft() {
- if (isOpen()) {
- if (offsetRatio != 1 && offsetRatio > (1 - needOffset)) {
- open();
- } else if (offsetRatio == 1) {
- if (clickToClose) {
- close();
- if (mListener != null) {
- mListener.onClosed(SwipeDragLayout.this);
- }
- }
+ private void springBack() {
+ if (isSpringBack && Math.abs(slideOver) < mBackDistance) {
+ mComponentSlideOver.setContentPositionX(slideOver);
+ }
+ }
+
+ private void rightLeftUp() {
+ if (mDownX - moveX < 0) {
+ if (mComponentSlideOver.getContentPositionX() > distance()) {
+ springBackRight();
} else {
- close();
- if (mListener != null) {
- mListener.onClosed(SwipeDragLayout.this);
- }
+ animationRightFrom();
}
} else {
- if (offsetRatio != 0 && offsetRatio < needOffset) {
- close();
- } else if (offsetRatio == 0) {
- getParent().requestDisallowInterceptTouchEvent(false);
+ isRight = false;
+ if ((mComponentSlide.getEstimatedWidth() - mComponentSlideOver.getContentPositionX()) > distance()) {
+ animationRightFrom();
+ animationCloseListener();
} else {
- open();
- if (mListener != null) {
- mListener.onOpened(SwipeDragLayout.this);
- }
+ animationRightTo();
}
}
}
- public void setIos(boolean ios) {
- this.ios = ios;
+ private void springBackRight() {
+ if (!isRight) {
+ isRight = true;
+ animationOpenListener();
+ animationRightTo();
+ } else {
+ if (isSpringBack) {
+ animationRightTo();
+ } else {
+ isRight = false;
+ animationRightFrom();
+ }
+ }
}
- public boolean isOpen() {
- return isOpen;
+ private void animationRightTo() {
+ mSlideAnimator.moveFromX(mComponentSlide.getContentPositionX()).moveToX(ZERO).setDuration(TIME).start();
+ mSlideOverAnimator.moveFromX(mComponentSlideOver.getContentPositionX())
+ .moveToX(mComponentSlide.getEstimatedWidth()).setDuration(TIME).start();
}
- public void open() {
- mCacheView = SwipeDragLayout.this;
- if (swipeDirection==DIRECTION_LEFT) {
- mDragHelper.smoothSlideViewTo(contentView, originPos.x - menuView.getWidth(),
- originPos.y);
- }else {
- mDragHelper.smoothSlideViewTo(contentView, originPos.x + menuView.getWidth(),
- originPos.y);
+ private void leftRightUp() {
+ if (mDownX - moveX > 0) {
+ if ((getScreenWidth() - mComponentSlide.getContentPositionX()) > distance()) {
+ springBackAnimation();
+ } else {
+ animationToX();
+ }
+ } else {
+ isLeft = false;
+ if ((mComponentSlideOver.getContentPositionX() + mComponentSlide.getEstimatedWidth()) > distance()) {
+ animationCloseListener();
+ animationToX();
+ } else {
+ animationFromX();
+ }
}
- isOpen = true;
- invalidate();
}
- public void close() {
- mDragHelper.smoothSlideViewTo(contentView, originPos.x, originPos.y);
- isOpen = false;
- mCacheView=null;
- invalidate();
+ private double distance() {
+ return mComponentSlide.getEstimatedWidth() * (needOffset / 10);
}
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- switch (ev.getAction()) {
- //防止多指拖拽
- case MotionEvent.ACTION_DOWN:
- if (isTouching){
- return false;
- }else {
- isTouching=true;
- }
- break;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- if (isTouching){
- isTouching=false;
- }
+ private void springBackAnimation() {
+ if (!isLeft) {
+ isLeft = true;
+ animationFromX();
+ animationOpenListener();
+ } else {
+ if (isSpringBack) {
+ animationFromX();
+ } else {
+ isLeft = false;
+ animationToX();
+ }
}
- return super.dispatchTouchEvent(ev);
}
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- switch (ev.getAction()) {
- case MotionEvent.ACTION_DOWN:
- if (mCacheView != null) {
- getParent().requestDisallowInterceptTouchEvent(true);
- if (mCacheView != this) {
- mCacheView.close();
- mCacheView = null;
- return true;
- } else if (isOpen && mDragHelper.isViewUnder(contentView, (int) ev.getX(),
- (int) ev.getY())) {
- //open时,不触发contentView的点击事件
- getParent().requestDisallowInterceptTouchEvent(true);
- return true;
- }
- }
- break;
+ private void animationCloseListener() {
+ if (swipeListener != null) {
+ swipeListener.onClosed(this);
}
+ }
- if (swipeEnable) {
- return mDragHelper.shouldInterceptTouchEvent(ev);
- }else {
- return super.onInterceptTouchEvent(ev);
+ private void animationOpenListener() {
+ if (swipeListener != null) {
+ swipeListener.onOpened(this);
}
+ }
+ private void animationFromX() {
+ if (mComponentSlide.getContentPositionX() < getScreenWidth()) {
+ mSlideAnimator.moveFromX(mComponentSlide.getContentPositionX())
+ .moveToX(slidingDistance()).setDuration(TIME).start();
+ mSlideOverAnimator.moveFromX(mComponentSlideOver.getContentPositionX())
+ .moveToX(-mComponentSlide.getEstimatedWidth()).setDuration(TIME).start();
+ }
+ }
+ private void animationToX() {
+ mSlideAnimator.moveFromX(mComponentSlide.getContentPositionX()).moveToX(getScreenWidth())
+ .setCurveType(Animator.CurveType.LINEAR).setDuration(TIME).start();
+ mSlideOverAnimator.moveFromX(mComponentSlideOver.getContentPositionX()).moveToX(0)
+ .setCurveType(Animator.CurveType.LINEAR).setDuration(TIME).start();
}
+ private boolean isLeftRight() {
+ return mLeftRight.equals(LEFT);
+ }
+ private float slideValue(double rightX) {
+ return mComponentSlide.getContentPositionX() + Math.round(rightX);
+ }
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (swipeEnable) {
- mDragHelper.processTouchEvent(event);
- return true;
- } else {
- return super.onTouchEvent(event);
- }
+ private float slideOver(double rightX) {
+ return mComponentSlideOver.getContentPositionX() + Math.round(rightX);
+ }
+ private int getScreenWidth() {
+ return DisplayManager.getInstance().getDefaultDisplay(mContext).get().getAttributes().width;
+ }
+
+ /**
+ * 配合ListContainer使用,使上一个item的菜单关闭
+ */
+ public void setListSlideDown() {
+ slideDown();
+ }
+
+ /**
+ * 设置左右
+ *
+ * @param lfRt 左右
+ */
+ public void setSwipeDirection(String lfRt) {
+ this.mLeftRight = lfRt;
+ }
+
+ /**
+ * 回弹效果
+ *
+ * @param isBack 是否开启
+ */
+ public void setOhos(boolean isBack) {
+ isSpringBack = isBack;
+ }
+
+ /**
+ * 是否可滑动
+ *
+ * @param isSlide 是否滑动
+ */
+ public void setSwipeEnable(boolean isSlide) {
+ this.isSliding = isSlide;
+ }
+
+ /**
+ * 是否开启水平布局左右调换
+ *
+ * @param isLr 默认false开启
+ */
+ public void setLtR(boolean isLr) {
+ this.isLtR = isLr;
}
@Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
+ public void onComponentBoundToWindow(Component component) {
+ mComponentSlide = getComponentAt(1);
+ mComponentSlideOver = getComponentAt(ZERO);
+ mSlideAnimator = mComponentSlide.createAnimatorProperty();
+ mSlideOverAnimator = mComponentSlideOver.createAnimatorProperty();
+ position();
+ }
- originPos.x = contentView.getLeft();
- originPos.y = contentView.getTop();
+ private int slidingDistance() {
+ return getScreenWidth() - mComponentSlide.getEstimatedWidth();
+ }
- if (DIRECTION_LEFT == swipeDirection) {
- //左滑
- menuView.layout(contentView.getWidth(), menuView.getTop(),
- contentView.getWidth() + menuView.getWidth(), menuView.getBottom());
+ private void position() {
+ if (isLeftRight()) {
+ mComponentSlide.setMarginLeft(getScreenWidth());
} else {
- //右滑
- menuView.layout(-menuView.getWidth(), menuView.getTop(), originPos.x
- , menuView.getBottom());
+ mComponentSlide.setMarginLeft(-mComponentSlide.getEstimatedWidth());
}
+ mBackDistance = mComponentSlide.getEstimatedWidth() * 4 / 3;
+ }
+ @Override
+ public void onComponentUnboundFromWindow(Component component) {
}
@Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- if (getChildCount()!=2){
- throw new UnsupportedOperationException("子View暂只支持两个");
+ public void onDragDown(Component component, DragInfo dragInfo) {
+ position();
+ if (!mLeftRight.equals(LEFT) && !mLeftRight.equals("right")) {
+ component.setEnabled(false);
}
- contentView = getChildAt(0);
- menuView = getChildAt(1);
- if (swipeDirection == DIRECTION_LEFT) {
- FrameLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT);
- params.gravity = Gravity.END;
- menuView.setLayoutParams(params);
- if (isInEditMode()) {
- menuView.layout(contentView.getWidth(), menuView.getTop(),
- contentView.getWidth() + menuView.getWidth(), menuView.getBottom());
- }
- } else if (isInEditMode()) {
- menuView.layout(-menuView.getWidth(), menuView.getTop(), contentView.getLeft()
- , menuView.getBottom());
+ if (!isLtR) {
+ mComponentSlide.setLayoutDirection(isLeftRight() ? LayoutDirection.LTR : LayoutDirection.RTL);
+ } else {
+ mComponentSlide.setLayoutDirection(isLeftRight() ? LayoutDirection.RTL : LayoutDirection.LTR);
+ }
+ if (swipeListContainerListener != null) {
+ swipeListContainerListener.clickSwipe(this);
+ }
+ if (mComponentSlideOver.getContentPositionX() == 0) {
+ isOpenCloseLeft = true;
+ } else {
+ isOpenCloseLeft = false;
}
}
@Override
- public void computeScroll() {
- if (mDragHelper.continueSettling(true)) {
- invalidate();
- }
+ public void onDragStart(Component component, DragInfo dragInfo) {
}
@Override
- protected void onDetachedFromWindow() {
- if (mCacheView == this) {
- mCacheView.close();
- mCacheView = null;
+ public void onDragUpdate(Component component, DragInfo dragInfo) {
+ if (dragInfo.xOffset > ZERO) {
+ if (isLeftRight()) {
+ closeLeft(dragInfo.xOffset);
+ } else {
+ openRight(dragInfo.xOffset);
+ }
+ } else if (dragInfo.xOffset < ZERO) {
+ if (isLeftRight()) {
+ openLeft(dragInfo.xOffset);
+ } else {
+ closeRight(dragInfo.xOffset);
+ }
+ } else {
+ HiLog.error(LABEL, "没有滑动");
}
- if (menuView!=null&&menuView.getTranslationX()!=0){
- menuView.setTranslationX(0f);
+ offsetRatio = dragInfo.xOffset - getPaddingLeft() / (float)mComponentSlide.getEstimatedWidth();
+ if (swipeListener != null) {
+ swipeListener.onUpdate(this, offsetRatio, (float) dragInfo.xOffset);
}
- super.onDetachedFromWindow();
+ }
+ @Override
+ public void onDragEnd(Component component, DragInfo dragInfo) {
}
@Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- //recyclerView复用时有点问题,需加以下代码确保layout完全关闭
- if (menuView!=null&&menuView.getTranslationX()!=0){
- menuView.setTranslationX(0);
- }
+ public void onDragCancel(Component component, DragInfo dragInfo) {
}
- public void addListener(SwipeListener listener) {
- mListener = listener;
+ /**
+ * 仅针对ListContaineriter滑动时,让上一个开启的item菜单关闭
+ */
+ public interface SwipeListContainerListener {
+ /**
+ * 开启
+ *
+ * @param swipeDragLayout this
+ */
+ void openSwipe(SwipeDragLayout swipeDragLayout);
+
+ /**
+ * 点击
+ *
+ * @param swipeDragLayout this
+ */
+ void clickSwipe(SwipeDragLayout swipeDragLayout);
}
- //滑动监听
+ /**
+ * 动画
+ */
public interface SwipeListener {
-
/**
* 拖动中,可根据offset 进行其他动画
- * @param layout
- * @param offsetRatio 偏移相对于menu宽度的比例
+ *
+ * @param layout this
+ * @param offsetRatio 偏移相对于menu宽度的比例
* @param offset 偏移量px
*/
- void onUpdate(SwipeDragLayout layout, float offsetRatio, float offset);
+ void onUpdate(SwipeDragLayout layout, double offsetRatio, float offset);
/**
* 展开完成
- * @param layout
+ *
+ * @param layout this
*/
void onOpened(SwipeDragLayout layout);
/**
* 关闭完成
- * @param layout
+ *
+ * @param layout this
*/
void onClosed(SwipeDragLayout layout);
}
-
}
diff --git a/swipelayout/src/main/java/com/ditclear/swipelayout/TypedAttrUtils.java b/swipelayout/src/main/java/com/ditclear/swipelayout/TypedAttrUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..cfae95a0bf97cc1ba3852bd14593cdf4ddd2ea61
--- /dev/null
+++ b/swipelayout/src/main/java/com/ditclear/swipelayout/TypedAttrUtils.java
@@ -0,0 +1,94 @@
+/*
+ * 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 a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ditclear.swipelayout;
+
+import ohos.agp.components.Attr;
+import ohos.agp.components.AttrSet;
+
+import java.util.NoSuchElementException;
+
+public class TypedAttrUtils {
+ private TypedAttrUtils() {
+ }
+
+ /**
+ * 是否开启
+ *
+ * @param attrs 属性集
+ * @param attrName 值
+ * @param isDefValue 值
+ * @return true是,反之
+ */
+ public static boolean getBoolean(AttrSet attrs, String attrName, boolean isDefValue) {
+ Attr attr = attrNoSuchElement(attrs, attrName);
+ if (attr == null) {
+ return isDefValue;
+ } else {
+ return attr.getBoolValue();
+ }
+ }
+
+ /**
+ * int值
+ *
+ * @param attrs 属性集
+ * @param attrName 属性
+ * @param defValue 值
+ * @return 对应int值
+ */
+ public static int getInt(AttrSet attrs, String attrName, int defValue) {
+ Attr attr = attrNoSuchElement(attrs, attrName);
+ if (attr == null) {
+ return defValue;
+ } else {
+ return attr.getIntegerValue();
+ }
+ }
+
+ /**
+ * string 类型
+ *
+ * @param attrs 属性集
+ * @param attrName 值
+ * @param defValue 值
+ * @return 信息
+ */
+ public static String getString(AttrSet attrs, String attrName, String defValue) {
+ Attr attr = attrNoSuchElement(attrs, attrName);
+ if (attr == null) {
+ return defValue;
+ } else {
+ return attr.getStringValue();
+ }
+ }
+
+ /**
+ * 属性处理
+ *
+ * @param attrs 属性集
+ * @param attrName 属性
+ * @return 对应值
+ */
+ private static Attr attrNoSuchElement(AttrSet attrs, String attrName) {
+ Attr attr = null;
+ try {
+ attr = attrs.getAttr(attrName).get();
+ } catch (NoSuchElementException e) {
+ e.fillInStackTrace();
+ }
+ return attr;
+ }
+}
diff --git a/swipelayout/src/main/res/values/attrs.xml b/swipelayout/src/main/res/values/attrs.xml
deleted file mode 100644
index 94effc5a16d5d8d0b442147cce7f5f078539b0e3..0000000000000000000000000000000000000000
--- a/swipelayout/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/swipelayout/src/main/resources/base/element/string.json b/swipelayout/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..b8ea0e1061f684e17e443e63810b62e8146b7276
--- /dev/null
+++ b/swipelayout/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "swipelayout_library",
+ "value": "swipelayout_library"
+ }
+ ]
+}
diff --git a/swipelayout/src/test/java/com/anlia/swipelayout/ExampleTest.java b/swipelayout/src/test/java/com/anlia/swipelayout/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..ac29ea437ee5cda5d94671302d94dcaca537fb5e
--- /dev/null
+++ b/swipelayout/src/test/java/com/anlia/swipelayout/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.anlia.swipelayout;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/swipelayout/swipelayout.iml b/swipelayout/swipelayout.iml
deleted file mode 100644
index 28fe55dfd7e0c898f32aea22fc9f94af8a2ea984..0000000000000000000000000000000000000000
--- a/swipelayout/swipelayout.iml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- generateDebugSources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file