feat:slider and flowlayout add reload api
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package pub.doric.shader.flowlayout;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
@@ -393,6 +394,23 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
@DoricMethod
|
||||
public void reload() {
|
||||
this.flowAdapter.loadAnchor = -1;
|
||||
// If reload,should reset native cache.
|
||||
for (int index = 0; index < this.flowAdapter.itemValues.size(); index++) {
|
||||
removeSubModel(this.flowAdapter.itemValues.valueAt(index));
|
||||
}
|
||||
this.flowAdapter.itemValues.clear();
|
||||
mView.post(new Runnable() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
flowAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
@@ -295,6 +295,21 @@ public class SliderNode extends SuperNode<RecyclerView> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DoricMethod
|
||||
public void reload() {
|
||||
slideAdapter.itemValues.clear();
|
||||
clearSubModel();
|
||||
mView.post(new Runnable() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
slideAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
Reference in New Issue
Block a user