Giter Site home page Giter Site logo

swanandmaratheblisstering / ti.swiperefreshlayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iskugor/ti.swiperefreshlayout

0.0 2.0 0.0 2.59 MB

Titanium module for Android's SwipeRefreshLayout.

License: Other

JavaScript 2.03% Python 2.08% Java 95.89%

ti.swiperefreshlayout's Introduction

Ti.SwipeRefreshLayout Titanium Module

tiswipe

Building the module

You'll need to modify "build.xml" and ".classpath" according to paths on your machine.

To initialize

The initialization of the module requires a handle to the scrollable view. If the scrollable view is in xml, you can create a new controller for the scrollable view and then pass it in as the view.

var myListView = Ti.UI.createListView({
	height: Ti.UI.FILL,
	width: Ti.UI.FILL
})

var swipeRefreshModule = require('com.rkam.swiperefreshlayout');
var swipeRefresh = swipeRefreshModule.createSwipeRefresh({
	view: myListView,
	height: Ti.UI.FILL,
	width: Ti.UI.FILL
});

$.content.add(swipeRefresh);

Setting color scheme

If you want to modify the 4 colours used in the progress bars at the top, modify the colors.xml file in (module folder)/platform/android/res/values which looks like this.

<?xml version="1.0" encoding="utf-8"?>
<resources>
	<!-- Declare SwipeRefreshLayout color scheme here -->
	<color name="color1">#1996BE</color>
	<color name="color2">#48B6D9</color>
	<color name="color3">#80D3ED</color>
	<color name="color4">#C2F0FF</color>
</resources>

Adding the event listener for when refresh happens

A refreshing event is fired when the swipe gesture is completed.

swipeRefresh.addEventListener('refreshing', function() {

	// Put your refresh code here

});

Set refreshing

Used to stop the progress bar animation when refreshing is done.

swipeRefresh.setRefreshing(false);

Check if refreshing

The state of the SwipeRefreshLayout, whether the animation is showing or not.

var isRefreshing = swipeRefresh.isRefreshing();

Alloy

Alloy usage example:

<Alloy>
	<Window>
		<SwipeRefresh module="com.rkam.swiperefreshlayout">
			<ListView>
				<!-- listview tags -->
			</ListView>
		</SwipeRefresh>
	</Window>
</Alloy>

ti.swiperefreshlayout's People

Contributors

iskugor avatar yissacharcw avatar angryduck2 avatar

Watchers

James Cloos avatar Swanand 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.