From 978a5eb1bba2c49f3a774ddd8ff0b390478e8cbb Mon Sep 17 00:00:00 2001 From: JeanGarf Date: Sun, 14 Jun 2020 12:50:07 +0200 Subject: [PATCH] #876 - ** Add shallDisplayZero in displayBalanceWithoutCurrency(...) to avoid displaying 0 --- .../java/org/gnucash/android/model/AccountType.java | 5 +++-- .../android/ui/transaction/SplitEditorFragment.java | 3 ++- .../ui/transaction/TransactionFormFragment.java | 13 ++++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/gnucash/android/model/AccountType.java b/app/src/main/java/org/gnucash/android/model/AccountType.java index 0738bc9f6..b45374ac7 100644 --- a/app/src/main/java/org/gnucash/android/model/AccountType.java +++ b/app/src/main/java/org/gnucash/android/model/AccountType.java @@ -220,12 +220,13 @@ public void displayBalance(final TextView balanceTextView, */ public void displayBalanceWithoutCurrency(final TextView transactionBalanceTextView, final Money transactionBalance, - final boolean shallDisplayNegativeSignumInSplits) { + final boolean shallDisplayNegativeSignumInSplits, + final boolean shallDisplayZero) { displayBalance(transactionBalanceTextView, transactionBalance, shallDisplayNegativeSignumInSplits, - false, + shallDisplayZero, false); } /** diff --git a/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java b/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java index a8c7c9412..d4e3503f2 100644 --- a/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java +++ b/app/src/main/java/org/gnucash/android/ui/transaction/SplitEditorFragment.java @@ -539,7 +539,8 @@ private void updateSplitAmountEditText(final Split split) { // Display abs value because switch button is visible accountType.displayBalanceWithoutCurrency(splitAmountEditText, splitValueWithSignum, - shallDisplayNegativeSignumInSplits); + shallDisplayNegativeSignumInSplits, + false); } /** diff --git a/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java b/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java index 3f3e2eae1..5f95277eb 100644 --- a/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java +++ b/app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java @@ -605,10 +605,12 @@ private void updateAmountEditText(final Money signedTransactionBalance) { ? signedTransactionBalance.negate() : signedTransactionBalance; + final boolean isTransactionTypeSwitchVisible = mTransactionTypeSwitch.getVisibility() != View.GONE; + accountType.displayBalanceWithoutCurrency(mAmountEditText, newSignedTransactionBalance, - shallDisplayNegativeSignumInSplits || (mTransactionTypeSwitch.getVisibility() - == View.GONE)); + shallDisplayNegativeSignumInSplits || !isTransactionTypeSwitchVisible, + !isTransactionTypeSwitchVisible); } private void setDoubleEntryViewsVisibility(int visibility) { @@ -1271,12 +1273,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK){ + // Once split editor has been used and saved, only allow editing through it + toggleAmountInputEntryMode(false); + setDoubleEntryViewsVisibility(View.GONE); + List splitList = data.getParcelableArrayListExtra(UxArgument.SPLIT_LIST); setSplitList(splitList); - //once split editor has been used and saved, only allow editing through it - toggleAmountInputEntryMode(false); - setDoubleEntryViewsVisibility(View.GONE); mOpenSplitEditor.setVisibility(View.VISIBLE); } }