Giter Club home page Giter Club logo

alloy-pull-to-refresh's Introduction

Titanium Alloy Sample solution of pull-to-refresh widget

This project shares without any author's license, so you can use it on your own mind

Widget placed in this path

Usage

Widget common usage is pretty simple. It reacts on App custom events:

refreshStartWorking
refreshStopWorking

So you just need to fire these custom events on app, when you need start or stop the refresh animation:

Ti.App.fireEvent('refreshStartWorking') //to start widget animation
Ti.App.fireEvent('refreshStopWorking') //to stop widget animation

Extended Usage

I tried to make it like gmail android app pull-to-refresh, so if you want to show user the growing bar when content pulling down, you need to set some globals in your app You can look in alloy.js file and see this globals. To make the bar growing you need to fire custom event pullDown And if user stop pulling down before edge fire event pullEnd I didn't want to do difficult calculations of pull pixels in each touchmove event, so I used a discrete increment and discrete edge of starting refresh widget

Alloy.Globals.pullHeight 
Alloy.Globals.pullIncrementor

The working logic of these globals is nearly simple, so you can download repo and watch this logic inside of your Titanium Studio

Finally

The main point of usage of this widget is to fire events in your app, so do it carefully. Don't forget to disable touch event or may be button(or something else you use to fire event) to prevent invalid events firing I added an defence code into widget to prevent refresh animation doubling but you can make your own defence in app. Any styles may to be changed in tss files.

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.