Skip to content

Commit

Permalink
codinguser#876 - ** Add shallDisplayZero in displayBalanceWithoutCurr…
Browse files Browse the repository at this point in the history
…ency(...) to avoid displaying 0
  • Loading branch information
JeanGarf committed Jun 14, 2020
1 parent 8f1767e commit 978a5eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/org/gnucash/android/model/AccountType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<Split> 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);
}
}
Expand Down

0 comments on commit 978a5eb

Please sign in to comment.