feat:fix nested slider
This commit is contained in:
parent
a2be39dbe3
commit
84e8a6e86d
@ -16,6 +16,8 @@
|
||||
package pub.doric.shader.flowlayout;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -41,7 +43,26 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> {
|
||||
private final FlowAdapter flowAdapter;
|
||||
private final StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(
|
||||
2,
|
||||
StaggeredGridLayoutManager.VERTICAL);
|
||||
StaggeredGridLayoutManager.VERTICAL) {
|
||||
@Override
|
||||
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
try {
|
||||
return super.scrollVerticallyBy(dy, recycler, state);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(int state) {
|
||||
try {
|
||||
super.onScrollStateChanged(state);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
private int columnSpace = 0;
|
||||
private int rowSpace = 0;
|
||||
private Rect padding = new Rect();
|
||||
@ -92,10 +113,13 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> {
|
||||
this.flowAdapter.itemCount = prop.asNumber().toInt();
|
||||
break;
|
||||
case "renderItem":
|
||||
this.flowAdapter.renderItemFuncId = prop.asString().value();
|
||||
String funcId = prop.asString().value();
|
||||
if (!funcId.equals(this.flowAdapter.renderItemFuncId)) {
|
||||
this.flowAdapter.renderItemFuncId = funcId;
|
||||
// If reset renderItem,should reset native cache.
|
||||
this.flowAdapter.itemValues.clear();
|
||||
clearSubModel();
|
||||
}
|
||||
break;
|
||||
case "batchCount":
|
||||
this.flowAdapter.batchCount = prop.asNumber().toInt();
|
||||
|
@ -85,10 +85,13 @@ public class ListNode extends SuperNode<RecyclerView> {
|
||||
this.listAdapter.itemCount = prop.asNumber().toInt();
|
||||
break;
|
||||
case "renderItem":
|
||||
this.listAdapter.renderItemFuncId = prop.asString().value();
|
||||
String funcId = prop.asString().value();
|
||||
if (!funcId.equals(this.listAdapter.renderItemFuncId)) {
|
||||
this.listAdapter.renderItemFuncId = funcId;
|
||||
// If reset renderItem,should reset native cache.
|
||||
this.listAdapter.itemValues.clear();
|
||||
clearSubModel();
|
||||
}
|
||||
break;
|
||||
case "batchCount":
|
||||
this.listAdapter.batchCount = prop.asNumber().toInt();
|
||||
|
@ -43,7 +43,7 @@ class SlideAdapter extends RecyclerView.Adapter<SlideAdapter.DoricViewHolder> {
|
||||
int itemCount = 0;
|
||||
int batchCount = 3;
|
||||
SparseArray<String> itemValues = new SparseArray<>();
|
||||
|
||||
String renderPageFuncId;
|
||||
SlideAdapter(SliderNode sliderNode) {
|
||||
this.sliderNode = sliderNode;
|
||||
}
|
||||
|
@ -137,8 +137,12 @@ public class SliderNode extends SuperNode<RecyclerView> {
|
||||
break;
|
||||
case "renderPage":
|
||||
// If reset renderItem,should reset native cache.
|
||||
String funcId = prop.asString().value();
|
||||
if (!funcId.equals(this.slideAdapter.renderPageFuncId)) {
|
||||
this.slideAdapter.itemValues.clear();
|
||||
clearSubModel();
|
||||
this.slideAdapter.renderPageFuncId = funcId;
|
||||
}
|
||||
break;
|
||||
case "batchCount":
|
||||
this.slideAdapter.batchCount = prop.asNumber().toInt();
|
||||
|
Reference in New Issue
Block a user