Exemplo n.º 1
0
$.tableView.addEventListener("postlayout", function handler() {
    $.tableView.removeEventListener("postlayout", handler);
    var parent = $.tableView.getParent();
    parent.remove($.tableView);
    var swipeRefreshModule = require('com.rkam.swiperefreshlayout');
    swipeRefresh = swipeRefreshModule.createSwipeRefresh({
        view: $.tableView,
        zIndex: $.tableView.zIndex,
        backgroundColor: $.tableView.backgroundColor,
        height: $.tableView.height,
        width: $.tableView.width
    });
    swipeRefresh.addEventListener('refreshing', function () {
        
        fetchNoticias(0,30);
        
        console.log('Listado Actualizado');
        
        if(swipeRefresh.isRefreshing()){
            swipeRefresh.setRefreshing(false);
        }
    });
    // adds it
    parent.add(swipeRefresh);
});
Exemplo n.º 2
0
        } else {
            Alloy.Globals.showFeedbackDialog(Alloy.Globals.PHRASES.noConnectionErrorTxt);
        }
    }
});

buildTableRows();

if (!isAndroid) {
    $.challenges_new.add(table);
} else {
    var swipeRefreshModule = require('com.rkam.swiperefreshlayout');

    swipeRefresh = swipeRefreshModule.createSwipeRefresh({
        view : table,
        height : Ti.UI.FILL,
        width : Ti.UI.FILL,
        id : 'swiper'
    });

    swipeRefresh.addEventListener('refreshing', function(e) {
        if (Alloy.Globals.checkConnection()) {
            setTimeout(function() {
                indicator.openIndicator();
                getChallenges();
            }, 800);
        } else {
            Alloy.Globals.showFeedbackDialog(Alloy.Globals.PHRASES.noConnectionErrorTxt);
            swipeRefresh.setRefreshing(false);
        }
    });
    $.challenges_new.add(swipeRefresh);