Image Image Image Image Image
Scroll to Top

To Top

Pull-To-Refresh

26

Jan
2012

9 Comments

In Pull-To-Refresh

By Chris Banes

Pull-to-Refresh v1.2

On 26, Jan 2012 | 9 Comments | In Pull-To-Refresh | By Chris Banes

Hey everyone,

I’ve just tagged v1.2 of the Pull-to-Refresh library on GitHub. You may have noticed there was no v1.1 post, well that was because 1.1 was a small bugfix release. Version 1.2 though is a much bigger release.

Here’s the changelog:

  • New (better) way of handling Touch Events
  • Add new way for PullToRefreshListView to work. Allows the user to scroll while it’s refreshing.
  • Fix Pull from Bottom happening when the view wasn’t completely at the bottom
  • Allow outside code to update the Widget to be refreshing (see setRefreshing())
  • Fix Padding being doubled when added via XML
  • New Translations
Thanks to Steve Lhomme, who provided quite a lot of code for this release.

Thanks,

You can grab it on GitHub: https://github.com/chrisbanes/Android-PullToRefresh

  • Sfgirl Lh

    Interesting.

  • Thomas Bouron

    Hi!

    Quick question: I use the ActionBarSherlock v4.0 library for my app. Is your library compatible with it?

    Thanks :)

    • chrisbanes

      I haven’t yet tried ABS v4, but it works perfectly with v3.x (and I see no reason why it will not work with v4).

      • Thomas Bouron

        Waouh, that was a quick answer! I’ll give a try and let you know.

        Anyway, thank you for this great library.

      • Thomas Bouron

        Ok, so i managed to get things work but there are little tricks:
        - First, the attribute “headerBackground” used into your library is not compatible with ActionBarSherlock 4.0 (already used) so i renamed it “ptrheaderBackground”, as well as “headerTextColor” to be more consistent.
        - Second, as i use ListFragment from Android compatibility package, it’s required to get the View created by the super method, remove the ListView from it and add your component with the same internal ID defined in ListFragment.java file (INTERNAL_LIST_CONTAINER_ID)

        Hope it can be useful for other people with this configuration :)

        • chrisbanes

          Thanks, I’m going to do a load of style changes for v1.3 so I’ll add these in.

          Regarding the ID, ListFragment uses android.R.id.list so (which the lib sets) so it should just work. It does for me anyway.

          • Thomas Bouron

            Yes, you’re right, it works with android.R.id.list, i was talking about INTERNAL_LIST_CONTAINER_ID in order to get the correct container to put the new PullToRefreshListView (and so, follow the same architecture as ListFragment)

            One more thing, is it possible to add a mode “none” to disable the feature sometimes?

          • chrisbanes

            Oh I understand now. Try this instead: http://pastebin.com/ZXxdRPbT

            There’s a setPullToRefreshEnabled method which does exactly what you want.

          • Thomas Bouron

            Thanks! That’s way more cleaner like this