feat:add OnRefresh Callback for Android
This commit is contained in:
parent
3dfa6c9770
commit
84b9ec0f22
@ -1,7 +1,5 @@
|
|||||||
package pub.doric.pullable;
|
package pub.doric.pullable;
|
||||||
|
|
||||||
import android.view.animation.Animation;
|
|
||||||
|
|
||||||
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 com.github.pengfeizhou.jscore.JavaValue;
|
import com.github.pengfeizhou.jscore.JavaValue;
|
||||||
@ -45,6 +43,14 @@ public class RefreshableNode extends SuperNode<DoricSwipeLayout> implements Pull
|
|||||||
mContentViewId = prop.asString().value();
|
mContentViewId = prop.asString().value();
|
||||||
} else if ("header".equals(name)) {
|
} else if ("header".equals(name)) {
|
||||||
mHeaderViewId = prop.asString().value();
|
mHeaderViewId = prop.asString().value();
|
||||||
|
} else if ("onRefresh".equals(name)) {
|
||||||
|
final String funcId = prop.asString().value();
|
||||||
|
mView.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
callJSResponse(funcId);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
super.blend(view, name, prop);
|
super.blend(view, name, prop);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,12 @@ class RefreshableDemo extends Panel {
|
|||||||
let refreshImage: Image
|
let refreshImage: Image
|
||||||
let refreshView = refreshable({
|
let refreshView = refreshable({
|
||||||
layoutConfig: layoutConfig().atmost(),
|
layoutConfig: layoutConfig().atmost(),
|
||||||
|
onRefresh: () => {
|
||||||
|
log('onRefresh')
|
||||||
|
setTimeout(() => {
|
||||||
|
refreshView.setRefreshing(context, false)
|
||||||
|
}, 5000)
|
||||||
|
},
|
||||||
header: pullable(context,
|
header: pullable(context,
|
||||||
stack([
|
stack([
|
||||||
image({
|
image({
|
||||||
|
Reference in New Issue
Block a user