Skip to content

Commit

Permalink
Corrected displayed money value in the split editor.
Browse files Browse the repository at this point in the history
Commit c1a40f3 changed the way the money amount is displayed in the split editor. If you entered a decimal value in a split transaction, saved and then edited the split again, the values now seemed to be rounded and you would have to enter the correct values again to make changes.
-> Deleted toShortString method in Money and changed it to toLocaleString in AccountType.displayBalance().

codinguser#876
  • Loading branch information
Thumas committed Aug 7, 2020
1 parent 163b9d2 commit 6e98dfa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
4 changes: 2 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 @@ -154,8 +154,8 @@ public void displayBalance(final TextView balanceTextView,
// Display value without currency and without decimals
balanceTextView.setText(!shallDisplayNegativeSignum
? balanceToDisplay.abs()
.toShortString()
: balanceToDisplay.toShortString());
.toLocaleString()
: balanceToDisplay.toLocaleString());

} else {
// Shall not display balance
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/java/org/gnucash/android/model/Money.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,6 @@ public String toPlainString(){
return mAmount.setScale(mCommodity.getSmallestFractionDigits(), ROUNDING_MODE).toPlainString();
}

/**
* Returns a locale-specific representation of the amount of the Money object (excluding the currency)
*
* @return String representation of the amount (without currency) of the Money object
*/
public String toShortString(){
return String.format(Locale.getDefault(), "%.0f", asDouble());
}

/**
* Returns a locale-specific representation of the amount of the Money object (excluding the currency)
*
Expand Down

0 comments on commit 6e98dfa

Please sign in to comment.