fix(refresher): finish animating before changing icon, hide when not in use

This commit is contained in:
Perry Govier
2014-08-07 17:54:30 -05:00
parent 8cf540e54c
commit c336e8ede8
5 changed files with 52 additions and 9 deletions

View File

@@ -20,6 +20,8 @@ IonicModule
function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $location, $rootScope, $document, $ionicScrollDelegate) {
var self = this;
// for testing
this.__timeout = $timeout;
this._scrollViewOptions = scrollViewOptions; //for testing
@@ -188,14 +190,28 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
var refresher = this.refresher = refresherElement;
var refresherHeight = self.refresher.clientHeight || 0;
scrollView.activatePullToRefresh(refresherHeight, function() {
// activateCallback
refresher.classList.add('active');
refresherScope.$onPulling();
}, function() {
refresher.classList.remove('refreshing');
refresher.classList.remove('active');
// deactivateCallback
$timeout(function(){
refresher.classList.remove('active');
refresher.classList.remove('refreshing');
refresher.classList.add('invisible');
},300);
}, function() {
// startCallback
refresher.classList.add('refreshing');
refresherScope.$onRefresh();
},function(){
// showCallback
refresher.classList.remove('invisible');
console.log('showing')
},function(){
// hideCallback
refresher.classList.add('invisible');
console.log('hiding');
});
};
}]);