fix: java.lang.IndexOutOfBoundsException
Inconsistency detected. Invalid view holder adapter positionViewHolder{b7a986a position=1 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached no parent} com.stardust.autojs.core.ui.widget.JsGridView{99f615b VFED..CL. ......ID 0,120-1080,1554 #133a2c2}, adapter:com.stardust.autojs.core.ui.widget.JsListView$Adapter@fe85df8, layout:android.support.v7.widget.GridLayoutManager@861c2d1, context:com.stardust.autojs.execution.ScriptExecuteActivity@6cd9514
This commit is contained in:
@@ -18,6 +18,15 @@ public class JsGridView extends JsListView {
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
setLayoutManager(new GridLayoutManager(getContext(), 1));
|
||||
setLayoutManager(new GridLayoutManager(getContext(), 1){
|
||||
@Override
|
||||
public void onLayoutChildren(Recycler recycler, State state) {
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
getScriptRuntime().console.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,9 @@ public class JsListView extends RecyclerView {
|
||||
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
|
||||
}
|
||||
|
||||
protected ScriptRuntime getScriptRuntime() {
|
||||
return mScriptRuntime;
|
||||
}
|
||||
|
||||
public void setOnItemTouchListener(OnItemTouchListener onItemTouchListener) {
|
||||
mOnItemTouchListener = onItemTouchListener;
|
||||
|
||||
Reference in New Issue
Block a user