Skip to content

Commit 10d76e4

Browse files
pnemonic78rivaldi8
authored andcommitted
Adding a split to the transaction was removing more rows than it should have: old transaction had n rows; the new transaction has n+1 rows; but the (n+1)th row was "Balance".
1 parent 85c13a1 commit 10d76e4

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/java/org/gnucash/android/ui/transaction/TransactionDetailActivity.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class TransactionDetailActivity extends PasscodeLockActivity {
5454

5555
private String mTransactionUID;
5656
private String mAccountUID;
57+
private int mDetailTableRows;
5758

5859
public static final int REQUEST_EDIT_TRANSACTION = 0x10;
5960

@@ -126,6 +127,7 @@ private void bindViews(){
126127
TextView balanceTextView = accountBalance.isNegative() ? mDebitBalance : mCreditBalance;
127128
TransactionsActivity.displayBalance(balanceTextView, accountBalance);
128129

130+
mDetailTableRows = mDetailTableLayout.getChildCount();
129131
boolean useDoubleEntry = GnuCashApplication.isDoubleEntryEnabled();
130132
LayoutInflater inflater = LayoutInflater.from(this);
131133
int index = 0;
@@ -175,8 +177,8 @@ private void refresh(){
175177
* Remove the split item views from the transaction detail prior to refreshing them
176178
*/
177179
private void removeSplitItemViews(){
178-
long splitCount = TransactionsDbAdapter.getInstance().getSplitCount(mTransactionUID);
179-
mDetailTableLayout.removeViews(0, (int)splitCount);
180+
// Remove all rows that are not special.
181+
mDetailTableLayout.removeViews(0, mDetailTableLayout.getChildCount() - mDetailTableRows);
180182
mDebitBalance.setText("");
181183
mCreditBalance.setText("");
182184
}

app/src/main/res/layout/activity_transaction_detail.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
android:stretchColumns="1"
7474
android:orientation="vertical" >
7575

76-
<TableRow android:layout_width="match_parent"
76+
<TableRow android:id="@+id/row_balance"
77+
android:layout_width="match_parent"
7778
android:layout_height="wrap_content"
7879
android:weightSum="5"
7980
android:paddingTop="5dp"

app/src/main/res/layout/item_split_amount_info.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
-->
1717
<TableRow xmlns:tools="http://schemas.android.com/tools"
1818
xmlns:android="http://schemas.android.com/apk/res/android"
19+
android:id="@+id/row_split_amount_info"
1920
android:layout_width="match_parent"
2021
android:layout_height="wrap_content"
2122
android:weightSum="5"

0 commit comments

Comments
 (0)