Android: fix list item action overlapped when sub view click set
This commit is contained in:
parent
8d8c44c8f6
commit
67ee81e90e
@ -18,14 +18,14 @@ package pub.doric.shader;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import pub.doric.DoricContext;
|
|
||||||
|
|
||||||
import com.github.pengfeizhou.jscore.JSArray;
|
import com.github.pengfeizhou.jscore.JSArray;
|
||||||
import com.github.pengfeizhou.jscore.JSObject;
|
import com.github.pengfeizhou.jscore.JSObject;
|
||||||
import com.github.pengfeizhou.jscore.JSValue;
|
import com.github.pengfeizhou.jscore.JSValue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import pub.doric.DoricContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: com.github.penfeizhou.doric.widget
|
* @Description: com.github.penfeizhou.doric.widget
|
||||||
* @Author: pengfei.zhou
|
* @Author: pengfei.zhou
|
||||||
@ -173,4 +173,8 @@ public abstract class GroupNode<F extends ViewGroup> extends SuperNode<F> {
|
|||||||
mChildNodes.clear();
|
mChildNodes.clear();
|
||||||
mChildViewIds.clear();
|
mChildViewIds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<ViewNode> getChildNodes() {
|
||||||
|
return mChildNodes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,11 @@ import com.github.pengfeizhou.jscore.JSArray;
|
|||||||
import com.github.pengfeizhou.jscore.JSObject;
|
import com.github.pengfeizhou.jscore.JSObject;
|
||||||
import com.github.pengfeizhou.jscore.JSValue;
|
import com.github.pengfeizhou.jscore.JSValue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
import pub.doric.extension.bridge.DoricPlugin;
|
import pub.doric.extension.bridge.DoricPlugin;
|
||||||
|
import pub.doric.shader.GroupNode;
|
||||||
import pub.doric.shader.StackNode;
|
import pub.doric.shader.StackNode;
|
||||||
|
import pub.doric.shader.ViewNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: com.github.penfeizhou.doric.widget
|
* @Description: com.github.penfeizhou.doric.widget
|
||||||
@ -91,6 +90,25 @@ public class ListItemNode extends StackNode {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
recursiveHandleLongClick(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recursiveHandleLongClick(GroupNode groupNode) {
|
||||||
|
for (int i = 0; i != groupNode.getChildNodes().size(); i++) {
|
||||||
|
ViewNode node = (ViewNode) groupNode.getChildNodes().get(i);
|
||||||
|
node.getView().setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
getView().performLongClick();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (node instanceof GroupNode) {
|
||||||
|
recursiveHandleLongClick((GroupNode) node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,8 @@ class ListVM extends ViewModel<ListModel, ListVH> {
|
|||||||
widthSpec: LayoutSpec.MOST,
|
widthSpec: LayoutSpec.MOST,
|
||||||
heightSpec: LayoutSpec.JUST,
|
heightSpec: LayoutSpec.JUST,
|
||||||
},
|
},
|
||||||
height: 50
|
height: 50,
|
||||||
|
onClick: () => {modal(context).alert(data.text)}
|
||||||
}), {
|
}), {
|
||||||
layoutConfig: {
|
layoutConfig: {
|
||||||
widthSpec: LayoutSpec.MOST,
|
widthSpec: LayoutSpec.MOST,
|
||||||
|
Reference in New Issue
Block a user