SwipeRefreshLayout Stays if not pulled fully

89 views Asked by At

Animation does not dismiss when i do not pull it fully it should go away if it has not been fully pulled

Animation does not dismiss when i do not pull it fully it should go away if it has not been fully pulled

enter image description here

My code is as follow

public class SwipeRefresh extends TiUIView {

    private MySwipeRefreshLayout layout;
    private TiViewProxy view;

    private Handler handler = new Handler();

    int layout_swipe_refresh = 0;

    // Constructor for SwipeRefresh
    public SwipeRefresh(final SwipeRefreshProxy proxy) {
        super(proxy);

        LayoutInflater inflater = LayoutInflater.from(TiApplication
                .getInstance());
        layout = (MySwipeRefreshLayout) inflater.inflate(layout_swipe_refresh,
                null, false);

        layout.setOnRefreshListener(new OnRefreshListener() {
            public void onRefresh() {
                if (proxy.hasListeners("refreshing")) {
                    proxy.fireEvent("refreshing", null);
                }
            }
        });

        setNativeView(layout);
    }

    private final Runnable refreshing2 = new Runnable() {
        public void run() {
            layout.setRefreshing(false);
            return;
        }
    };

    public boolean isRefreshing() {
        return this.layout.isRefreshing();
    }

    public void setRefreshing(boolean refreshing) {
        handler.post(refreshing2);
    }
}

do i have to override an event ?

0

There are 0 answers