Fixes Android presentation of the balance button.

This commit is contained in:
Andy Phillipson 2016-12-15 15:38:15 -05:00
commit dd25901d19
2 changed files with 35 additions and 8 deletions

View file

@ -269,6 +269,16 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
}; };
function refreshAmountSection(scrollPos) { function refreshAmountSection(scrollPos) {
$scope.showBalanceButton = false;
if ($scope.wallet.status) {
$scope.showBalanceButton = ($scope.wallet.status.totalBalanceSat != $scope.wallet.status.spendableAmount);
}
if (!$scope.amountIsCollapsible) {
var t = ($scope.showBalanceButton ? 15 : 45);
$scope.amountScale = 'translateY(' + t + 'px)';
return;
}
scrollPos = scrollPos || 0; scrollPos = scrollPos || 0;
var amountHeight = 210 - scrollPos; var amountHeight = 210 - scrollPos;
if (amountHeight < 80) { if (amountHeight < 80) {
@ -290,18 +300,16 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
var s = amountScale; var s = amountScale;
// Make space for the balance button when it needs to display. // Make space for the balance button when it needs to display.
var TOP_NO_BALANCE_BUTTON = 45; var TOP_NO_BALANCE_BUTTON = 115;
var TOP_BALANCE_BUTTON = 10; var TOP_BALANCE_BUTTON = 30;
var top = TOP_NO_BALANCE_BUTTON; var top = TOP_NO_BALANCE_BUTTON;
$scope.showBalanceButton = ($scope.wallet.status.totalBalanceSat != $scope.wallet.status.spendableAmount);
if ($scope.showBalanceButton) { if ($scope.showBalanceButton) {
top = TOP_BALANCE_BUTTON; top = TOP_BALANCE_BUTTON;
$scope.showBalanceButton = true;
} }
var amountTop = ((amountScale - 0.5) / 0.5) * top; var amountTop = ((amountScale - 0.7) / 0.7) * top;
if (amountTop < 5) { if (amountTop < -10) {
amountTop = 5; amountTop = -10;
} }
if (amountTop > top) { if (amountTop > top) {
amountTop = top; amountTop = top;

View file

@ -46,7 +46,7 @@
ng-show="!updateStatusError && wallet.walletScanStatus != 'error' && !wallet.balanceHidden" ng-show="!updateStatusError && wallet.walletScanStatus != 'error' && !wallet.balanceHidden"
on-hold="hideToggle()" on-hold="hideToggle()"
ng-style="{'transform': amountScale}" ng-style="{'transform': amountScale}"
class="amount__balance"> ng-class="{amount__balance: amountIsCollapsible}">
<strong class="size-36">{{status.totalBalanceStr}}</strong> <strong class="size-36">{{status.totalBalanceStr}}</strong>
<div <div
class="size-14 amount-alternative" class="size-14 amount-alternative"
@ -121,6 +121,25 @@
<span class="size-12 db m10" translate>This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it from the local information.</span> <span class="size-12 db m10" translate>This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it from the local information.</span>
<a class="button button-outline button-light button-small" ng-click='recreate()' translate>Recreate</a> <a class="button button-outline button-light button-small" ng-click='recreate()' translate>Recreate</a>
</div> </div>
<div ng-click='updateAll(true)' ng-show="!updateStatusError && !wallet.balanceHidden" on-hold="hideToggle()" ng-style="{'transform': amountScale}">
<strong class="size-36">{{status.totalBalanceStr}}</strong>
<div class="size-14 amount-alternative" ng-if="status.totalBalanceAlternative">{{status.totalBalanceAlternative}} {{status.alternativeIsoCode}}</div>
</div>
<div ng-if="!wallet.balanceHidden && showBalanceButton" ng-style="{'opacity': altAmountOpacity, 'transform': amountScale}">
<button class="button button-standard button-primary amount__button-balance size-14" ng-click="openBalanceModal()">
<i class="icon ion-ios-checkmark-outline"></i>
<strong>
{{status.spendableBalanceStr}}
</strong>
&nbsp;
<span>
{{status.spendableBalanceAlternative}} {{status.alternativeIsoCode}}
</span>
</button>
</div>
<div ng-show="!updateStatusError && wallet.balanceHidden" on-hold="hideToggle()"> <div ng-show="!updateStatusError && wallet.balanceHidden" on-hold="hideToggle()">
<strong class="size-24" translate>[Balance Hidden]</strong> <strong class="size-24" translate>[Balance Hidden]</strong>
<div class="size-14" translate> <div class="size-14" translate>