Skip to content

Commit 08014a2

Browse files
committed
Merge branch '0.12-dev' into dev
2 parents 09a697e + 8819f96 commit 08014a2

File tree

6 files changed

+55
-21
lines changed

6 files changed

+55
-21
lines changed
-91.9 KB
Binary file not shown.

android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ private void initFramework(String framework){
954954
private void invokeCallJSBatch(Message message) {
955955
if (mNextTickTasks.isEmpty() || !isJSFrameworkInit()) {
956956
if (!isJSFrameworkInit()) {
957-
WXLogUtils.e("[WXBridgeManager] invokeCallJSBatch: framework.js uninitialized.");
957+
WXLogUtils.e("[WXBridgeManager] invokeCallJSBatch: framework.js uninitialized!! message:"+message.toString());
958958
}
959959
return;
960960
}
@@ -1116,7 +1116,7 @@ private boolean isJSThread() {
11161116
private void invokeRegisterModules(Map<String, Object> modules, List<Map<String, Object>> failReceiver) {
11171117
if (modules == null || !isJSFrameworkInit()) {
11181118
if (!isJSFrameworkInit()) {
1119-
WXLogUtils.e("[WXBridgeManager] invokeCallJSBatch: framework.js uninitialized.");
1119+
WXLogUtils.e("[WXBridgeManager] invokeRegisterModules: framework.js uninitialized.");
11201120
}
11211121
failReceiver.add(modules);
11221122
return;
@@ -1137,7 +1137,7 @@ private void invokeRegisterComponents(List<Map<String, Object>> components, List
11371137
throw new RuntimeException("Fail receiver should not use source.");
11381138
}
11391139
if (!isJSFrameworkInit()) {
1140-
WXLogUtils.e("[WXBridgeManager] invokeCallJSBatch: framework.js uninitialized.");
1140+
WXLogUtils.e("[WXBridgeManager] invokeRegisterComponents: framework.js uninitialized.");
11411141

11421142
for (Map<String,Object> comp:components){
11431143
failReceiver.add(comp);

android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ WXComponent findDirectListChild(WXComponent comp) {
315315
return null;
316316
}
317317

318-
if (parent instanceof WXListComponent) {
318+
if (parent instanceof BasicListComponent) {
319319
return comp;
320320
}
321321

@@ -551,7 +551,7 @@ public int getScrollX() {
551551
}
552552

553553
/**
554-
* Append a child component to the end of WXListComponent. This will not refresh the underlying
554+
* Append a child component to the end of list. This will not refresh the underlying
555555
* view immediately. The message of index of the inserted child is given to the adapter, and the
556556
* adapter will determine when to refresh. The default implementation of adapter will push the
557557
* message into a message and refresh the view in a period of time.
@@ -661,7 +661,7 @@ protected void addSubView(View child, int index) {
661661
}
662662

663663
/**
664-
* Remove the child from WXListComponent. This method will use {@link
664+
* Remove the child from list. This method will use {@link
665665
* java.util.List#indexOf(Object)} to retrieve the component to be deleted. Like {@link
666666
* #addChild(WXComponent)}, this method will not refresh the view immediately, the adapter will
667667
* decide when to refresh.
@@ -743,7 +743,7 @@ public void onViewRecycled(ListBaseViewHolder holder) {
743743
* Bind the component of the position to the holder. Then flush the view.
744744
*
745745
* @param holder viewHolder, which holds reference to the view
746-
* @param position position of component in WXListComponent
746+
* @param position position of component in list
747747
*/
748748
@Override
749749
public void onBindViewHolder(ListBaseViewHolder holder, int position) {

android/sdk/src/main/java/com/taobao/weex/ui/component/list/StickyHeaderHelper.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ private void showSticky() {
8787
final float translationX = headerView.getTranslationX();
8888
final float translationY = headerView.getTranslationY();
8989
headComponent.removeSticky();
90-
mParent.post(WXThread.secure(new Runnable() {
91-
@Override
92-
public void run() {
93-
ViewGroup existedParent;
94-
if ((existedParent = (ViewGroup) headerView.getParent()) != null) {
95-
existedParent.removeView(headerView);
96-
}
97-
mParent.addView(headerView);
98-
//recover translation, sometimes it will be changed on fling
99-
headerView.setTranslationX(translationX);
100-
headerView.setTranslationY(translationY);
101-
}
102-
}));
90+
91+
ViewGroup existedParent;
92+
if ((existedParent = (ViewGroup) headerView.getParent()) != null) {
93+
existedParent.removeView(headerView);
94+
}
95+
mParent.addView(headerView);
96+
//recover translation, sometimes it will be changed on fling
97+
headerView.setTranslationX(translationX);
98+
headerView.setTranslationY(translationY);
99+
100+
}
101+
if (headComponent.getDomObject().getEvents().contains("sticky")) {
102+
headComponent.fireEvent("sticky");
103103
}
104104
}
105105

@@ -124,6 +124,9 @@ public void run() {
124124
component.recoverySticky();
125125
}
126126
}));
127+
if (component.getDomObject().getEvents().contains("unsticky")) {
128+
component.fireEvent("unsticky");
129+
}
127130
}
128131

129132

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.taobao.weex.ui.view.listview;
2+
3+
import android.support.v7.widget.RecyclerView;
4+
import android.support.v7.widget.StaggeredGridLayoutManager;
5+
6+
import com.taobao.weex.WXEnvironment;
7+
import com.taobao.weex.utils.WXLogUtils;
8+
9+
/**
10+
* Created by zhengshihan on 2017/5/5.
11+
*/
12+
13+
public class ExtendedStaggeredGridLayoutManager extends StaggeredGridLayoutManager{
14+
15+
public ExtendedStaggeredGridLayoutManager(int spanCount, int orientation) {
16+
super(spanCount, orientation);
17+
}
18+
19+
@Override
20+
public void onItemsRemoved(RecyclerView recyclerView, int positionStart, int itemCount) {
21+
if(positionStart ==-1){
22+
WXLogUtils.e("ExtendedStaggeredGridLayoutManager: onItemsRemoved Error Invalid Index : positionStart :"+positionStart +" itemCount:"+ itemCount);
23+
return ;
24+
}else {
25+
if(WXEnvironment.isApkDebugable()){
26+
WXLogUtils.e("ExtendedStaggeredGridLayoutManager: onItemsRemoved positionStart :"+positionStart+" itemCount:"+ itemCount);
27+
}
28+
}
29+
super.onItemsRemoved(recyclerView, positionStart, itemCount);
30+
}
31+
}

android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void initView(Context context, int type, int columnCount, float columnGap
7373
if (type == TYPE_GRID_LAYOUT) {
7474
setLayoutManager(new GridLayoutManager(context, columnCount,orientation,false));
7575
} else if (type == TYPE_STAGGERED_GRID_LAYOUT) {
76-
setLayoutManager(new StaggeredGridLayoutManager(columnCount, orientation));
76+
setLayoutManager(new ExtendedStaggeredGridLayoutManager(columnCount, orientation));
7777
} else if (type == TYPE_LINEAR_LAYOUT) {
7878
setLayoutManager(new ExtendedLinearLayoutManager(context,orientation,false));
7979
}

0 commit comments

Comments
 (0)