From cd0916bc0c1a10ffad3c7b3e6067babd2d5176de Mon Sep 17 00:00:00 2001 From: JeanGarf Date: Sat, 7 Mar 2020 16:01:39 +0100 Subject: [PATCH] #876 - Enhance Code Quality --- .../export/csv/CsvTransactionsExporter.java | 1 - .../gnucash/android/model/AccountType.java | 7 +- .../java/org/gnucash/android/model/Money.java | 2 +- .../ui/transaction/SplitEditorFragment.java | 1 + .../layout/activity_transaction_detail.xml | 172 ++++++++++-------- 5 files changed, 99 insertions(+), 84 deletions(-) diff --git a/app/src/main/java/org/gnucash/android/export/csv/CsvTransactionsExporter.java b/app/src/main/java/org/gnucash/android/export/csv/CsvTransactionsExporter.java index f298cd201..25a8e704c 100644 --- a/app/src/main/java/org/gnucash/android/export/csv/CsvTransactionsExporter.java +++ b/app/src/main/java/org/gnucash/android/export/csv/CsvTransactionsExporter.java @@ -26,7 +26,6 @@ import org.gnucash.android.R; import org.gnucash.android.export.ExportParams; import org.gnucash.android.export.Exporter; -import org.gnucash.android.model.Account; import org.gnucash.android.model.Split; import org.gnucash.android.model.Transaction; import org.gnucash.android.model.TransactionType; 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 edc2e1a1d..245819b1f 100644 --- a/app/src/main/java/org/gnucash/android/model/AccountType.java +++ b/app/src/main/java/org/gnucash/android/model/AccountType.java @@ -65,7 +65,7 @@ public enum AccountType { /** * Display the balance of a transaction in a text view and format the text color to match the sign of the amount * @param balanceTextView {@link android.widget.TextView} where balance is to be displayed - * @param balance {@link org.gnucash.android.model.Money} balance to display + * @param balance {@link org.gnucash.android.model.Money} balance (>0 or <0) to display */ public void displayBalance(final TextView balanceTextView, final Money balance) { @@ -97,11 +97,6 @@ public void displayBalance(final TextView balanceTextView, final boolean isCreditBalance = balance.isNegative(); -// fontColor = isCreditBalance -// ? context.getResources() -// .getColor(R.color.debit_red) -// : context.getResources() -// .getColor(R.color.credit_green); fontColor = getAmountColor(isCreditBalance); } diff --git a/app/src/main/java/org/gnucash/android/model/Money.java b/app/src/main/java/org/gnucash/android/model/Money.java index 0c3ddd145..2df937a44 100644 --- a/app/src/main/java/org/gnucash/android/model/Money.java +++ b/app/src/main/java/org/gnucash/android/model/Money.java @@ -50,7 +50,7 @@ public final class Money implements Comparable{ private Commodity mCommodity; /** - * Amount value held by this object + * Amount value held by this object (can be > 0 or < 0) */ private BigDecimal mAmount; 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 8de1cb932..6cf6116ff 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 @@ -483,6 +483,7 @@ private void initViews(final Split split) { splitAmountEditText.setCommodity(split.getValue() .getCommodity()); + splitAmountEditText.setValue(split.getFormattedValue() .asBigDecimal()); diff --git a/app/src/main/res/layout/activity_transaction_detail.xml b/app/src/main/res/layout/activity_transaction_detail.xml index f0a2d3739..aac29c9f7 100644 --- a/app/src/main/res/layout/activity_transaction_detail.xml +++ b/app/src/main/res/layout/activity_transaction_detail.xml @@ -25,6 +25,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + android:stretchColumns="1" + android:orientation="vertical"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + +