You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/05/12 08:25:14 UTC
[15/33] incubator-weex git commit: + [android] add list
sticky/unSticky event
+ [android] add list sticky/unSticky event
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d7655b85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d7655b85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d7655b85
Branch: refs/heads/master
Commit: d7655b85b9b6c089b00a63df365155116fb98c99
Parents: 58eaa9d
Author: lybeen <il...@gmail.com>
Authored: Tue May 9 10:56:48 2017 +0800
Committer: lybeen <il...@gmail.com>
Committed: Tue May 9 10:56:48 2017 +0800
----------------------------------------------------------------------
.../ui/component/list/StickyHeaderHelper.java | 29 +++++++++++---------
1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d7655b85/android/sdk/src/main/java/com/taobao/weex/ui/component/list/StickyHeaderHelper.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/StickyHeaderHelper.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/StickyHeaderHelper.java
index dd49a5a..d046a1e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/StickyHeaderHelper.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/StickyHeaderHelper.java
@@ -87,19 +87,19 @@ public class StickyHeaderHelper {
final float translationX = headerView.getTranslationX();
final float translationY = headerView.getTranslationY();
headComponent.removeSticky();
- mParent.post(WXThread.secure(new Runnable() {
- @Override
- public void run() {
- ViewGroup existedParent;
- if ((existedParent = (ViewGroup) headerView.getParent()) != null) {
- existedParent.removeView(headerView);
- }
- mParent.addView(headerView);
- //recover translation, sometimes it will be changed on fling
- headerView.setTranslationX(translationX);
- headerView.setTranslationY(translationY);
- }
- }));
+
+ ViewGroup existedParent;
+ if ((existedParent = (ViewGroup) headerView.getParent()) != null) {
+ existedParent.removeView(headerView);
+ }
+ mParent.addView(headerView);
+ //recover translation, sometimes it will be changed on fling
+ headerView.setTranslationX(translationX);
+ headerView.setTranslationY(translationY);
+
+ }
+ if (headComponent.getDomObject().getEvents().contains("sticky")) {
+ headComponent.fireEvent("sticky");
}
}
@@ -124,6 +124,9 @@ public class StickyHeaderHelper {
component.recoverySticky();
}
}));
+ if (component.getDomObject().getEvents().contains("unSticky")) {
+ component.fireEvent("unSticky");
+ }
}