GithubHelp home page GithubHelp logo

oudommeas / android-pulltorefresh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johannilsson/android-pulltorefresh

1.0 2.0 0.0 267 KB

This project aims to provide a reusable pull to refresh widget for Android.

android-pulltorefresh's Introduction

Pull To Refresh for Android

This project aims to provide a reusable pull to refresh widget for Android.

Screenshot

Repository at https://github.com/johannilsson/android-pulltorefresh.

Usage

Layout

<!--
  The PullToRefreshListView replaces a standard ListView widget.
-->
<com.markupartist.android.widget.PullToRefreshListView
    android:id="@+id/android:list"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    />

Activity

// Set a listener to be invoked when the list should be refreshed.
((PullToRefreshListView) getListView()).setOnRefreshListener(new OnRefreshListener() {
    @Override
    public void onRefresh() {
        // Do work to refresh the list here.
        new GetDataTask().execute();
    }
});

private class GetDataTask extends AsyncTask<Void, Void, String[]> {
    ...
    @Override
    protected void onPostExecute(String[] result) {
        mListItems.addFirst("Added after refresh...");
        // Call onRefreshComplete when the list has been refreshed.
        ((PullToRefreshListView) getListView()).onRefreshComplete();
        super.onPostExecute(result);
    }
}

Last Updated

It's possible to add a last updated time using the method setLastUpdated and onRefreshComplete. The text provided to these methods will be set below the Release to refresh text. Note that the time representation is not validated replaces the previous text, which means that it's possible and recommended to add a text similar to "Last Update: 15:23". This might be changed in future versions.

1.5 Support

To use the widget on 1.5 the necessary drawables needs to be copied to that projects drawable folder. The drawables needed by the widget can be found in the drawable-hdpi folder in the library project.

Contributors

Are you using this widget?

If you are using this widget please feel free to add your app to the wiki.

License

Copyright (c) 2011 Johan Nilsson

Licensed under the Apache License, Version 2.0

android-pulltorefresh's People

Contributors

aheuermann avatar chdorner avatar eddieringle avatar emidander avatar johannilsson avatar kidfolk avatar loopj avatar quiffman avatar timimahoney avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.