infinitered / bluepotion

Like RedPotion, but for Android
MIT License
74 stars 18 forks source link

Basic Refreshable #77

Closed GantMan closed 9 years ago

GantMan commented 9 years ago

The code is a lot like iOS. Just add refreshable to the class, and use on_refresh and stop_refreshing. This requires the ultra pull to refresh gradle

    # pull to refresh
    dependency 'in.srain.cube:ultra-ptr:1.0.10'

Caveat:

Wrap your listview in the XML tag to identify what is Pull to Refresh

    <in.srain.cube.views.ptr.PtrClassicFrameLayout
        android:id="@+id/store_house_ptr_frame"
        xmlns:cube_ptr="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

       <ListView
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/list_view"
           android:layout_gravity="center_horizontal" />

    </in.srain.cube.views.ptr.PtrClassicFrameLayout>

I'd love to remove this, so listviews are automatically wrapped, but that's a bit outside our needs right now.

Special thanks to @markrickert who answered some amazing questions about refreshable on ProMotion, and @fvonhoven for moral support on XML woes :+1:

Example added to home application

jamonholmgren commented 9 years ago

nice

skellock commented 9 years ago