jolicode / Alloy-PullToRefresh

Pull to refresh widget for Titanium Alloy applications.
MIT License
55 stars 10 forks source link

Alloy PullToRefresh

Description

The Titanium Alloy PullToRefresh widget allows to refresh the page with a pull down when using a ListView and TableView. Available for iOS and Android, without any dependencie. For iOS we use the native refreshControl, and for Android it's a custom pull to refresh. The header pull view is personalizable and can be in multiples languages.

Demo

iOS Gif Demo

Android Gif Demo

Overview

iOS PTR View

Android PTR PullDown Android PTR Release Android PTR Loading

Installation

Manual install

  1. Download this widget and put it in the folder app/widgets
  2. Declare the depedency in the app/config.json file:

    "dependencies": {
        "com.jolicode.pullToRefresh": "1.0"
    }

Gittio install

You can use the gitTio CLI

    $ gittio install com.jolicode.pullToRefresh

Configuration

In your principal controller:

Internationalization

This widget can be in multiples languages, that's there are 4 keys you have to indicate the string phrases :

  1. loading
  2. release_to_update
  3. pull_to_reload
  4. updated_at

You can for example put this code in your /i18n/en/string.xml file:

<string name="loading">Loading</string>
<string name="release_to_update">Release to update</string>
<string name="pull_to_reload">Pull to reload</string>
<string name="updated_at">Update at</string>

You can find the same example in french in the widget file i18n/fr/string.xml-dist.

For more info in internationalization and i18n look the documentation.

Example

You can find an example in the folder example.

Changelog

1.2 _ 2014-07-31

1.0 _ 2014-03-25

Wishlist

Works also with ScrollView

The native ios RefreshControl don't work for ScrollView (see the doc).

Therefore maybe we can use instead of it the headerpullview used for Android. Surently in the next version if a kind dev can do it ?