better balance collapse animation performance on android

This commit is contained in:
Marty Alcala 2016-11-11 16:52:41 -05:00
commit f80f2b8775
2 changed files with 30 additions and 6 deletions

View file

@ -10,6 +10,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.openTxpModal = txpModalService.open; $scope.openTxpModal = txpModalService.open;
$scope.isCordova = platformInfo.isCordova; $scope.isCordova = platformInfo.isCordova;
$scope.isAndroid = platformInfo.isAndroid; $scope.isAndroid = platformInfo.isAndroid;
$scope.isIOS = platformInfo.isIOS;
$scope.openExternalLink = function(url, target) { $scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target); externalLinkService.open(url, target);
@ -239,8 +240,13 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.amountHeight = '180px'; $scope.amountHeight = '180px';
$scope.amountScale = 'scale3d(' + 1 + ',' + 1 + ',' + 1+ ')'; $scope.amountScale = 'scale3d(' + 1 + ',' + 1 + ',' + 1+ ')';
var prevPos;
$scope.getScrollPosition = function(){ $scope.getScrollPosition = function(){
var pos = $ionicScrollDelegate.getScrollPosition().top; var pos = $ionicScrollDelegate.getScrollPosition().top;
if(pos === prevPos) {
return;
}
prevPos = pos;
var amountHeight = 180 - pos; var amountHeight = 180 - pos;
if(amountHeight < 80) { if(amountHeight < 80) {
amountHeight = 80; amountHeight = 80;
@ -262,16 +268,30 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.altAmountOpacity = (amountHeight - 100)/80; $scope.altAmountOpacity = (amountHeight - 100)/80;
$window.requestAnimationFrame(function() { //$window.requestAnimationFrame(function() {
$scope.amountHeight = amountHeight + 'px'; $scope.amountHeight = amountHeight + 'px';
$scope.contentMargin = contentMargin + 'px'; $scope.contentMargin = contentMargin + 'px';
$scope.amountScale = 'scale3d(' + s + ',' + s + ',' + s+ ')'; $scope.amountScale = 'scale3d(' + s + ',' + s + ',' + s+ ')';
$scope.$evalAsync(angular.noop); //$scope.$evalAsync(angular.noop);
}); //});
}; };
$scope.$on("$ionicView.beforeEnter", function(event, data) { // $scope.getScrollPosition();
// $timeout(function() {
//
// }, 300);
var scrollInterval;
$scope.$on("$ionicView.enter", function(event, data) {
scrollInterval = $interval(function(){
$scope.getScrollPosition();
}, 10);
});
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.walletId = data.stateParams.walletId; $scope.walletId = data.stateParams.walletId;
storageService.getBackupFlag($scope.walletId, function(err, flag) { storageService.getBackupFlag($scope.walletId, function(err, flag) {
$scope.isBackedUp = flag ? true : false; $scope.isBackedUp = flag ? true : false;
@ -298,6 +318,10 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
]; ];
}); });
$scope.$on("$ionicView.beforeLeave", function(event, data) {
$interval.cancel(scrollInterval);
});
$scope.$on("$ionicView.leave", function(event, data) { $scope.$on("$ionicView.leave", function(event, data) {
lodash.each(listeners, function(x) { lodash.each(listeners, function(x) {
x(); x();

View file

@ -11,7 +11,7 @@
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<div class="bp-content" ng-class="{'status-bar': isCordova}"> <div class="bp-content" ng-class="{'status-bar': isCordova && isIOS}">
<div class="amount-wrapper" ng-show="wallet && wallet.isComplete()" ng-style="{'background-color':wallet.color}"> <div class="amount-wrapper" ng-show="wallet && wallet.isComplete()" ng-style="{'background-color':wallet.color}">
<div <div
@ -76,7 +76,7 @@
<span ng-include="'views/includes/walletInfo.html'"></span> <span ng-include="'views/includes/walletInfo.html'"></span>
</div> </div>
</div> <!-- oh --> </div> <!-- oh -->
<ion-content on-scroll="getScrollPosition()" ng-style="{'margin-top': contentMargin}"> <ion-content ng-style="{'margin-top': contentMargin}">
<ion-refresher <ion-refresher
ng-if="isAndroid" ng-if="isAndroid"
pulling-icon="ion-ios-refresh" pulling-icon="ion-ios-refresh"