Swipe Refresh objects using the CreateSwipeRefreshLayout method of the Support object:
sup.CreateSwipeRefreshLayout( options );
Example - Simple
app.LoadPlugin( "Support" );
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
sup = app.CreateSupport();
swipe = sup.CreateSwipeRefreshLayout( "FillXY" );
lst = app.CreateList( "Item 1,Item 2,Item 3,Item 4,Item 5,Item 6" );
swipe.AddChild( lst );
lay.AddChild( swipe );
app.AddLayout( lay );
}
swipe.SetOnRefresh( Callback );
Example - On Refresh
app.LoadPlugin( "Support" );
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
sup = app.CreateSupport();
swipe = sup.CreateSwipeRefreshLayout( "FillXY" );
swipe.SetColors( "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF" );
swipe.SetBackColor( "#333333" );
swipe.SetOnRefresh( swipe_OnRefresh );
lst = app.CreateList( "Item 1,Item 2,Item 3,Item 4,Item 5,Item 6" );
swipe.AddChild( lst );
lay.AddChild( swipe );
app.AddLayout( lay );
}
function swipe_OnRefresh()
{
setTimeout(function(){
lst.InsertItem( 0, "Item "+Math.floor(Math.random()*10) );
swipe.SetRefreshing( false );
}, 1000 );
}
The following methods are available on the Swipe Refresh object:
GetType()
SetOnRefresh( callback )
SetRefreshing( boolean )
SetColors( color1, color2, color3, color4 )
SetBackColor( color )
AddChild( child )
Other Methods:
Show Other Methods